oliezekat / symfony-lock-filetouch
Files touch() storage implementation for Symfony Lock component
Package info
github.com/oliezekat/symfony-lock-filetouch
pkg:composer/oliezekat/symfony-lock-filetouch
1.0.4
2026-08-10 20:23 UTC
Requires
- php: >=8.1
- symfony/lock: ^6.4 || ^7.0 || ^8.0
Requires (Dev)
- phpunit/phpunit: ^10.5 || ^11.5 || ^13.3
- squizlabs/php_codesniffer: ^4.0
This package is auto-updated.
Last update: 2026-08-10 20:36:49 UTC
README
A storage implementation for Symfony Lock component, based on the PersistingStoreInterface which uses touch(), file_exists(), or filemtime() on empty files within a dedicated directory.
It supports locking, blocking mode, and auto-release across different applications, provided they use the same directory and the same maximum lifetime.
Lock refresh() requires a TTL that is less than or equal to the maximum lifetime.
Installation
composer require oliezekat/symfony-lock-filetouch
Usage
use Oliezekat\SymfonyLockFileTouch\Store; use Symfony\Component\Lock\Factory; $store = new Store(/* $directoryPath, $lifeTime */); $store->setDirectoryPath(sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'test'); $store->setLifeTime(300); $factory = new Factory($store); $lock = $factory->createLock('test'); if ($lock->acquire()) { ... $lock->refresh(); } ... $lock->release();
Resources
- Symfony Lock FileTouch project on GitHub
- Symfony Lock documentation
- Symfony Lock 6.4 code for PHP 8.1
- Symfony Lock 7.4 code for PHP 8.2
- Symfony Lock 8.1 code for PHP 8.4