HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux ip-172-31-42-149 5.15.0-1084-aws #91~20.04.1-Ubuntu SMP Fri May 2 07:00:04 UTC 2025 aarch64
User: ubuntu (1000)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/vhost/disk-apps/magento.bikenow.co/vendor/webimpress/safe-writer/README.md
# Webimpress Safe Writer

[![Unit Tests](https://github.com/webimpress/safe-writer/actions/workflows/phpunit.yml/badge.svg)](https://github.com/webimpress/safe-writer/actions/workflows/phpunit.yml)
[![Coding Standards](https://github.com/webimpress/safe-writer/actions/workflows/phpcs.yml/badge.svg)](https://github.com/webimpress/safe-writer/actions/workflows/phpcs.yml)
[![Static Analysis](https://github.com/webimpress/safe-writer/actions/workflows/static-analysis.yml/badge.svg)](https://github.com/webimpress/safe-writer/actions/workflows/static-analysis.yml)
[![Coverage Status](https://coveralls.io/repos/github/webimpress/safe-writer/badge.svg?branch=master)](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 = "<?php\nreturn " . var_export($data, true) . ';';

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

If something goes wrong exception (instance of `Webimpress\SafeWriter\Exception\ExceptionInterface`)
will be thrown.