Helthe CQRS is a small library implementing command-query separation. It's based on the refactored version of LiteCQRS and the work of Mark Nijhof for his CQRS book.
Currently, the library only implements command handling using a command bus for communication.
Add the following in your composer.json
:
{
"require": {
// ...
"helthe/cqrs": "dev-master"
}
}
$ composer require 'helthe/cqrs=dev-master'
The component contains mainly helper interfaces for implementing CQRS. Some basic implementations are also included.
use Helthe\Component\CQRS\Bus\SequentialCommandBus;
use Helthe\Component\CQRS\Command\CommandInterface;
use Helthe\Component\CQRS\CommandHandler\CommandHandlerInterface;
use Helthe\Component\CQRS\CommandHandler\MemoryCommandHandlerLocator;
/* @var CommandInterface */
$command = new Command()
/* @var CommandHandlerInterface */
$handler = new CommandHandler()
$locator = new MemoryCommandHandlerLocator();
$locator->register(get_class($command), $handler);
$bus = new SequentialCommandBus($locator);
$bus->dispatch($command);
For bugs or feature requests, please create an issue.