1. Go to this page and download the library: Download keystone/tactician-deferred 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/ */
keystone / tactician-deferred example snippets
use Keystone\Tactician\Deferred\Command\DeferrableCommand;
class SendWelcomeCommand implements DeferrableCommand
{
public $email;
public $name;
public function __construct(string $email, string $name)
{
$this->email = $email;
$this->name = $name;
}
public function getKey(): string
{
// The command key is used to determine which queue to publish to.
return 'email';
}
}
class SendWelcomeHandler
{
public function handle(SendWelcomeCommand $command)
{
// Send the welcome
}
}
$commandBus = new CommandBus([new DeferredMiddleware(...), new CommandHandlerMiddleware(...)]);
$commandBus->handle(new SendWelcomeCommand('[email protected]', 'Ben'));
use Keystone\Queue\Consumer;
use Keystone\Queue\Provider;
$provider = new Provider(...);
$consumer = new Consumer($provider, ...);
// The consumer will poll the queue for new messages and process them.
$consumer->consume();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.