lyoshenka / php-simple-lock
A simple PHP advisory lock implementation. Uses flock() internally.
Installs: 42
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/lyoshenka/php-simple-lock
Requires
- php: >=5.3.3
This package is not auto-updated.
Last update: 2025-10-11 22:55:59 UTC
README
Install
"require": { "lyoshenka/php-simple-lock": "~1.0" }
or from the command-line:
composer require lyoshenka/php-simple-lock
Usage
use SimpleLock\Lock; $lock = Lock::acquire('lockname'); if ($lock) { // lock acquired. protected code goes here. Lock::release($lock); }
If you want to change the location where lockfiles are stored:
Lock::setLockDir('/path/to/lock/dir');
Bugs/Fixes
File issues here, submit pull requests, or email me: alex@grin.io