Tool to write files safely, to avoid race conditions
- dev-develop / 2.2.x-dev
- dev-master / 2.1.x-dev
This package is auto-updated.
Last update: 2021-01-18 07:52:26 UTC
Write files safely to avoid race conditions when the same file is written multiple times in a short time period.
$ 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.