PHP code example of frankdejonge / locked-console-command
1. Go to this page and download the library: Download frankdejonge/locked-console-command library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
frankdejonge / locked-console-command example snippets
use FrankDeJonge\LockedConsoleCommand\LockedCommandDecorator;
use Symfony\Component\Console\Application;
$application = new Application;
$app->add(new LockedCommandDecorator(new YourConsoleCommand()));
$app->run();
use FrankDeJonge\LockedConsoleCommand\LockedCommandDecorator;
Artisan::add(new LockedCommandDecorator(new SomeCommand()));
$command = new LockedCommandDecorator($yourCommand, 'lock-name', '/lock/path'));
class SomeQueueWorker extends Command implements SpecifiesLockName
{
public function getLockName(InputInterface $input)
{
return 'root:name:'.$input->getArgument('worker-id');
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.