Need help with safe-writer?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

329 Stars 5 Forks BSD 2-Clause "Simplified" License 90 Commits 3 Opened issues


Write files safely, to avoid race conditions

Services available


Need anything else?

Contributors list

# 479,606
json-schema 3.0K PHP top 10

Webimpress Safe Writer

Build Status Coverage Status

Write files safely to avoid race conditions when the same file is written multiple times in a short time period.


Using composer:

$ composer require webimpress/safe-writer


use Webimpress\SafeWriter\FileWriter;

$targetFile = DIR . '/target-file.php'; $content = "<?php \nreturn " . var_export($data, true) . ';';

FileWriter::writeFile($targetFile, $content);

If something goes wrong exception (instance of

) will be thrown.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.