Command Bus library


Keywords
ddd, command bus
License
MIT

Documentation

CommandBus

develop
codecov
Build Status

Simple library to route a command to its handler, the interface allows you to compose buses to add capabilities. Each handler must be a callable.

Installation

composer require innmind/command-bus

Example

use function Innmind\CommandBus\bootstrap;
use Innmind\Immutable\Map;

class MyCommand {}

$echo = function(MyCommand $command) {
    echo 'foo';
};

$handle = bootstrap()['bus'](
    Map::of('string', 'callable')
        (MyCommand::class, $echo)
);

$handle(new MyCommand); //prints 'foo' and return null;