PHP Enterprise Service Bus Facade supporting CQRS
Prooph is the organisation behind gingerframework - a workflow framework written in PHP. The founder and lead developer is codeliner. Prooph provides CQRS+ES infrastructure components for the gingerframework. The components are split into 3 major libraries ProophServiceBus, ProophEventSourcing, ProophEventStore and various minor libraries which add additional features or provide support for other frameworks. The public APIs of the major components are stable. They are loosely coupled among each other and with the gingerframework, so you can mix and match them with other libraries.
The goal of ProophServiceBus is to provide a powerful CQRS layer on top of different messaging/worker tools like PhpResque, RabbitMQ, Pheanstalk or RESTful Messaging API. It is designed with flexibility in mind. An event-driven system provides the possibility to add plugins for additional functionality. You can easily hook into the process and adjust it to meet your needs.
You can install ProophServiceBus via composer by adding "prooph/service-bus": "~1.0"
as requirement to your composer.json.
The simplest way to get started is to set up a command or event bus with the default components provided by ProophServiceBus.
use Prooph\ServiceBus\CommandBus;
use Prooph\ServiceBus\Example\Command\EchoText;
use Prooph\ServiceBus\InvokeStrategy\CallbackStrategy;
use Prooph\ServiceBus\Router\CommandRouter;
$commandBus = new CommandBus();
$router = new CommandRouter();
//Register a callback as CommandHandler for the EchoText command
$router->route('Prooph\ServiceBus\Example\Command\EchoText')
->to(function (EchoText $aCommand) {
echo $aCommand->getText();
});
//Expand command bus with the router plugin
$commandBus->utilize($router);
//Expand command bus with the callback invoke strategy
$commandBus->utilize(new CallbackStrategy());
//Create a new Command
$echoText = EchoText::fromPayload('It works');
//... and dispatch it
$commandBus->dispatch($echoText);
//Output should be: It works
- Ask questions on prooph-users google group.
- File issues at https://github.com/prooph/service-bus/issues.
Please feel free to fork and extend existing or add new features and send a pull request with your changes! To establish a consistent code quality, please provide unit tests for all your changes and may adapt the documentation.