Skip to content
This repository has been archived by the owner on Mar 11, 2024. It is now read-only.

Innmind/CommandBus

Repository files navigation

CommandBus

Build Status codecov Type Coverage

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;

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages