1. Go to this page and download the library: Download phpgears/cqrs-tactician 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/ */
phpgears / cqrs-tactician example snippets
use Gears\CQRS\Tactician\CommandBus;
use Gears\CQRS\Tactician\CommandHandlerMiddleware;
use League\Tactician\CommandBus as TacticianBus;
use League\Tactician\Handler\Locator\InMemoryLocator;
use League\Tactician\Plugins\LockingMiddleware;
$commandToHandlerMap = [];
$tacticianBus = new TacticianBus([
new LockingMiddleware(),
new CommandHandlerMiddleware(new InMemoryLocator($commandToHandlerMap)),
]);
$commandBus = new CommandBus($tacticianBus);
/** @var \Gears\CQRS\Command $command */
$commandBus->handle($command);
use Gears\CQRS\Tactician\QueryBus;
use Gears\CQRS\Tactician\QueryHandlerMiddleware;
use League\Tactician\CommandBus as TacticianBus;
use League\Tactician\Handler\Locator\InMemoryLocator;
use League\Tactician\Plugins\LockingMiddleware;
$queryToHandlerMap = [];
$tacticianBus = new TacticianBus([
new LockingMiddleware(),
new QueryHandlerMiddleware(new InMemoryLocator($queryToHandlerMap)),
]);
$queryBus = new QueryBus($tacticianBus);
/** @var \Gears\CQRS\Query $query */
$result = $queryBus->handle($query);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.