Download the PHP package tourze/lock-service-bundle without Composer
On this page you can find all versions of the php package tourze/lock-service-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package lock-service-bundle
Lock Service Bundle
中文
A flexible distributed lock service bundle for Symfony, supporting Redis Cluster, database, and file-based backends. Ideal for resource mutual exclusion and synchronization in high concurrency scenarios.
Features
- Supports Redis Cluster, database, and file lock backends
- SmartLockStore for automatic backend switching
- Provides read/write locks, blocking locks, and multi-resource locking
- Seamless integration with Symfony ecosystem
- Easy to extend and customize
Requirements
- PHP >= 8.1
- Symfony >= 6.4
- Redis, database, or file backend configured
Installation
Composer
Quick Start
Configuration
Bundle Registration
Add to your bundles.php:
Environment Configuration
Select lock type via APP_LOCK_TYPE environment variable:
- redis
- redis-cluster
- dbal
- flock
Example:
Database Configuration
If using DBAL backend, the bundle automatically configures a dedicated lock
connection with SQLite for testing. For production, configure your database
connection in doctrine.yaml:
Advanced Usage
- Automatic backend switching via SmartLockStore
- Retry and wait mechanism for lock acquisition
- Read/write lock support (see RedisClusterStore)
- Extensible: implement
LockEntityinterface for custom lock resources
Entity Design
This bundle provides a LockEntity interface for defining lock resources:
Implement this interface for your business entities to enable fine-grained distributed locking.
Security
This bundle provides secure distributed locking mechanisms:
- Thread-safe lock acquisition and release
- Automatic lock expiration to prevent deadlocks
- Resource isolation through unique lock keys
- Protection against race conditions in concurrent environments
Security Considerations
- Use unique, unpredictable lock keys for sensitive resources
- Set appropriate lock timeouts to prevent resource starvation
- Monitor lock usage to detect potential abuse
- Use dedicated Redis/database instances for production environments
Contributing
Please see CONTRIBUTING.md for details. Follow PSR standards and provide tests.
License
MIT License
Changelog
See CHANGELOG.md
All versions of lock-service-bundle with dependencies
doctrine/doctrine-bundle Version ^2.13
monolog/monolog Version ^3.1
psr/log Version ^3|^2|^1
symfony/config Version ^7.3
symfony/console Version ^7.3
symfony/dependency-injection Version ^7.3
symfony/doctrine-bridge Version ^7.3
symfony/event-dispatcher Version ^7.3
symfony/framework-bundle Version ^7.3
symfony/http-kernel Version ^7.3
symfony/lock Version ^7.3
symfony/messenger Version ^7.3
symfony/property-access Version ^7.3
symfony/service-contracts Version ^3.6
symfony/yaml Version ^7.3
tourze/bundle-dependency Version 1.*
tourze/redis-dedicated-connection-bundle Version 1.0.*
tourze/symfony-dependency-service-loader Version 1.0.*