https://github.com/webimpress/safe-writer
Write files safely, to avoid race conditions
https://github.com/webimpress/safe-writer
concurrent-write file-writer php race-condition-prevention safe-writer
Last synced: 25 days ago
JSON representation
Write files safely, to avoid race conditions
- Host: GitHub
- URL: https://github.com/webimpress/safe-writer
- Owner: webimpress
- License: bsd-2-clause
- Created: 2019-10-28T09:57:58.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2025-03-10T20:26:01.000Z (11 months ago)
- Last Synced: 2025-03-10T21:28:09.616Z (11 months ago)
- Topics: concurrent-write, file-writer, php, race-condition-prevention, safe-writer
- Language: PHP
- Size: 274 KB
- Stars: 376
- Watchers: 6
- Forks: 9
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Webimpress Safe Writer
[](https://github.com/webimpress/safe-writer/actions/workflows/phpunit.yml)
[](https://github.com/webimpress/safe-writer/actions/workflows/phpcs.yml)
[](https://github.com/webimpress/safe-writer/actions/workflows/static-analysis.yml)
[](https://coveralls.io/github/webimpress/safe-writer?branch=master)
Write files safely to avoid race conditions when
the same file is written multiple times in a short time period.
## Installation
Using composer:
```console
composer require webimpress/safe-writer
```
## Usage
```php
use Webimpress\SafeWriter\FileWriter;
$targetFile = __DIR__ . '/target-file.php';
$content = "