PHP Enterprise Service Bus Implementation supporting CQRS and DDD

Installs: 2 822

Dependents: 9

Stars: 54

Watchers: 8

Forks: 6

Open Issues: 2

Language: PHP

v4.5 2015-10-06 16:32 UTC


PHP 5.5+ lightweight message bus supporting CQRS and Micro Services

Build Status Coverage Status Gitter

Messaging API

prooph/service-bus is a lightweight messaging facade. It allows you to define the API of your model with the help of messages.

  1. Command messages describe the actions your model can handle.
  2. Event messages describe things that happened while your model handled a command.
  3. Query messages describe available information that can be fetched from your model.

prooph/service-bus shields your model. Data input and output ports become irrelevant and no longer influence the business logic. I'm looking at you Hexagonal Architecture.

prooph/service-bus decouples your model from any framework. You can use a web framework like Zend, Symfony, Laravel and co. to handle http requests and pass them via prooph/service-bus to your model but you can also receive the same messages via CLI or from a message queue system like RabbitMQ or Beanstalkd.



You can install prooph/service-bus via composer by adding "prooph/service-bus": "~4.0" as requirement to your composer.json.

Quick Start


use Prooph\ServiceBus\CommandBus;
use Prooph\ServiceBus\Example\Command\EchoText;
use Prooph\ServiceBus\Plugin\Router\CommandRouter;

$commandBus = new CommandBus();

$router = new CommandRouter();

//Register a callback as CommandHandler for the EchoText command
    ->to(function (EchoText $aCommand) {
        echo $aCommand->getText();

//Expand command bus with the router plugin

//We create a new Command
$echoText = new EchoText('It works');

//... and dispatch it

//Output should be: It works




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.


Please refer to the project composer.json for the list of dependencies.


Released under the New BSD License.