tourze / symfony-lock-command-bundle
Installs: 111
Dependents: 2
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: ^8.1
- psr/log: ^3|^2|^1
- symfony/console: ^6.4
- symfony/framework-bundle: ^6.4
- symfony/lock: ^6.4
- yiisoft/json: ^1.0
Requires (Dev)
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^10.0
This package is auto-updated.
Last update: 2025-04-17 13:33:15 UTC
README
A Symfony bundle that provides locking mechanism for console commands to prevent concurrent execution.
Features
- Automatic command locking based on command class and input parameters
- Prevents multiple instances of the same command from running simultaneously
- Easy integration with Symfony console commands
- Configurable lock duration
- Automatic lock release after command completion
Installation
You can install the package via composer:
composer require tourze/symfony-lock-command-bundle
Quick Start
- Register the bundle in your
config/bundles.php
:
return [ // ... Tourze\LockCommandBundle\LockCommandBundle::class => ['all' => true], ];
- Create a lockable command by extending
LockableCommand
:
use Tourze\LockCommandBundle\Command\LockableCommand; class YourCommand extends LockableCommand { protected static $defaultName = 'app:your-command'; protected function execute(InputInterface $input, OutputInterface $output) { // Your command logic here return Command::SUCCESS; } }
The command will automatically be locked based on the command class name and input parameters.
Contributing
Please see CONTRIBUTING.md for details.
License
The MIT License (MIT). Please see License File for more information.