PHPackages                             gabriel-peleskei/lock-file - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. gabriel-peleskei/lock-file

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

gabriel-peleskei/lock-file
==========================

Creating lock file for single instance execution

0.1.1(7y ago)022MITPHPPHP &gt;=5.6.0

Since Dec 2Pushed 7y agoCompare

[ Source](https://github.com/gabriel-peleskei/php-lock-file)[ Packagist](https://packagist.org/packages/gabriel-peleskei/lock-file)[ RSS](/packages/gabriel-peleskei-lock-file/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (2)Versions (2)Used By (0)

php-lock-file
=============

[](#php-lock-file)

Mechanism to create/remove and test a lock file. This allows to run a php script only once (as single instance).

Basic Usage
-----------

[](#basic-usage)

```
use GabrielPeleskei\LockFile\Exception\GeneralException;
use GabrielPeleskei\LockFile\Exception\IsLockedException;
use GabrielPeleskei\LockFile\LockFile;

try {
    $locker = new LockFile(__DIR__ . '/.basic.lock', []);
    $locker->start(); // throws if lock file exists
    echo "Processing...\n";
    // do whatever..
    // with destructor called,
    // lockfile should be removed at the end...
} catch (IsLockedException $e) {
    echo "Locked: Process is locked!\n";
    exit(1);
} catch (GeneralException $e) {
    // possible write permission problems...
    echo "EXCEPTION: {$e->getMessage()} ({$e->getCode()})\n";
    exit(2);
}
exit;
```

For use cases with interruptions, look into the /examples folder

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 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

2718d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/911cf8a568e24ac59fe65817c9435c2576856d7b6cfda431312395c00d73d92a?d=identicon)[gabriel-peleskei](/maintainers/gabriel-peleskei)

---

Top Contributors

[![gabriel-peleskei](https://avatars.githubusercontent.com/u/27891270?v=4)](https://github.com/gabriel-peleskei "gabriel-peleskei (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/gabriel-peleskei-lock-file/health.svg)

```
[![Health](https://phpackages.com/badges/gabriel-peleskei-lock-file/health.svg)](https://phpackages.com/packages/gabriel-peleskei-lock-file)
```

PHPackages © 2026

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