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

webimpress
353 Stars 5 Forks BSD 2-Clause "Simplified" License 105 Commits 2 Opened issues

Description

Write files safely, to avoid race conditions

Services available

!
?

Need anything else?

Contributors list

Webimpress Safe Writer

Unit Tests Coding Standards Static Analysis Coverage Status

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

Installation

Using composer:

$ composer require webimpress/safe-writer

Usage

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

Webimpress\SafeWriter\Exception\ExceptionInterface
) 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.