tourze/symfony-lock-command-bundle

0.0.2 2025-04-08 08:39 UTC

This package is auto-updated.

Last update: 2025-04-17 13:33:15 UTC


README

Latest Version Total Downloads

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

  1. Register the bundle in your config/bundles.php:
return [
    // ...
    Tourze\LockCommandBundle\LockCommandBundle::class => ['all' => true],
];
  1. 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.