PHP library for executing queued commands
<?php
use Ambientia\QueueCommand\QueueCommandEntity;
use App\MyModule\MyService;
use Doctrine\Common\Persistence\ObjectManager;
$queueCommand = new QueueCommandEntity();
$queueCommand->setService(MyService::class);
/** @var ObjectManager $entityManager */
$entityManager->persist($queueCommand);
$entityManager->flush();
<?php
namespace App\MyModule;
class MyService
{
public function execute(int $arg1)
{
//do some stuff
$result = $arg1 + 1;
// return some message if needed
return "$arg1 processed ro $result";
}
}
* * * * * ambientia:queue-command:execute >> /path/to/log/file 2>&1
- remove container dependency
- todo replace merge it with find in EntityProcessor
- add general manager/repository
- todo add waiting / persistent running
Run php cs fixer ./vendor/bin/php-cs-fixer fix
Run tests with phpunit ./vendor/bin/phpunit
Run phan ./vendor/bin/phan