1. Go to this page and download the library: Download stepovenko/console-mutex 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/ */
stepovenko / console-mutex example snippets
use Illuminated\Console\WithoutOverlapping;
class ExampleCommand extends Command
{
use WithoutOverlapping;
// ...
}
class ExampleCommand extends Command
{
use WithoutOverlapping;
protected string $mutexStrategy = 'mysql';
// ...
}
class ExampleCommand extends Command
{
use WithoutOverlapping;
public function __construct()
{
parent::__construct();
$this->setMutexStrategy('mysql');
}
// ...
}
class ExampleCommand extends Command
{
use WithoutOverlapping;
// In milliseconds
protected ?int $mutexTimeout = 3000;
// ...
}
class ExampleCommand extends Command
{
use WithoutOverlapping;
public function __construct()
{
parent::__construct();
// In milliseconds
$this->setMutexTimeout(3000);
}
// ...
}
class ExampleCommand extends Command
{
use WithoutOverlapping;
public function getMutexName()
{
return 'shared-for-command1-and-command2';
}
// ...
}
class ExampleCommand extends Command
{
use WithoutOverlapping;
public function getMutexFileStorage()
{
return storage_path('my/custom/path');
}
// ...
}
class ExampleCommand extends Command
{
use WithoutOverlapping;
protected function initialize(InputInterface $input, OutputInterface $output)
{
// You have to call it first
$this->initializeMutex();
// Then goes your custom code
$this->foo = $this->argument('foo');
$this->bar = $this->argument('bar');
$this->baz = $this->argument('baz');
}
// ...
}
class ExampleCommand extends Command
{
use Loggable;
use WithoutOverlapping;
// ...
}
class ExampleCommand extends Command
{
use Loggable;
use WithoutOverlapping;
protected function initialize(InputInterface $input, OutputInterface $output)
{
// Initialize conflicting traits
$this->initializeMutex();
$this->initializeLogging();
}
// ...
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.