PHPackages                             ferdous/flock-write - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. ferdous/flock-write

ActiveLibrary[File &amp; Storage](/categories/file-storage)

ferdous/flock-write
===================

This is a library for File lock write operation in a single shared storage

v0.1.0-alpha(4y ago)01MITPHP

Since Jan 27Pushed 4y ago1 watchersCompare

[ Source](https://github.com/ferdousulhaque/flock-write)[ Packagist](https://packagist.org/packages/ferdous/flock-write)[ RSS](/packages/ferdous-flock-write/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

File Lock Write Operation Using Flock
=====================================

[](#file-lock-write-operation-using-flock)

This library is for simultaneous write on a single file with locking mechanism by PHP flock function. It uses the unix semaphore to lock the file and hence a safe application to store data in a single file shared by multiple methods.

Installation
------------

[](#installation)

This library is compatible with all PHP version starting from 4 to 8. Just run the following command to install.

```
composer require ferdous/flock-write

```

How to add
----------

[](#how-to-add)

Add the following operations to the namespace

```
use Ferdous\FileLockWrite\FileOperation;
use Ferdous\FileLockWrite\LockService;
```

Now you are ready to add the functionality by creating the object

```
$lockService = new LockService();
$opObj = new FileOperation($filepath, $filename,  $lockService, $data);
```

### *Operations*

[](#operations)

- Truncate File ```
    $opObj->truncateFile()
    ```
- Write File *with Exclude Lock*```
    $opObj->writeDataToFileAppend()
    ```
- Read File *with Shared Lock*```
    $opObj->readDataFromFile()
    ```

Unit Tests
----------

[](#unit-tests)

For checking the unit tests run

```
./vendor/bin/phpunit . --testdox --color
```

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity1

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1568d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9ab1b88ecc345016d46cddbcda5cfb04ae70f7a7f2509e6aaa75bdb7b9cc205c?d=identicon)[ferdous](/maintainers/ferdous)

---

Top Contributors

[![ferdousulhaque](https://avatars.githubusercontent.com/u/36291549?v=4)](https://github.com/ferdousulhaque "ferdousulhaque (4 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ferdous-flock-write/health.svg)

```
[![Health](https://phpackages.com/badges/ferdous-flock-write/health.svg)](https://phpackages.com/packages/ferdous-flock-write)
```

###  Alternatives

[knplabs/gaufrette

PHP library that provides a filesystem abstraction layer

2.5k39.8M123](/packages/knplabs-gaufrette)[google/cloud-storage

Cloud Storage Client for PHP

34390.8M125](/packages/google-cloud-storage)[illuminate/filesystem

The Illuminate Filesystem package.

15261.6M2.6k](/packages/illuminate-filesystem)[superbalist/flysystem-google-storage

Flysystem adapter for Google Cloud Storage

26320.6M30](/packages/superbalist-flysystem-google-storage)[creocoder/yii2-flysystem

The flysystem extension for the Yii framework

2931.7M62](/packages/creocoder-yii2-flysystem)[flowjs/flow-php-server

PHP library for handling chunk uploads. Works with flow.js html5 file uploads.

2451.6M15](/packages/flowjs-flow-php-server)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
