Skip to content

onliner/command-bus

Repository files navigation

Command Bus

This is easy to use PHP command bus implementation.

Version Total Downloads Php License Build Status

Installation

The preferred way to install this extension is through composer.

Either run

composer require onliner/command-bus:^0.1.0

or add this code line to the require section of your composer.json file:

"onliner/command-bus": "^0.1.0"

Usage

use Onliner\CommandBus\Builder;

class Hello
{
    public $message;

    public function __construct(string $message)
    {
        $this->message = $message;
    }
}

$dispatcher = (new Builder())
    ->handle(Hello::class, function (Hello $command) {
        echo 'Hello ' . $command->message;
    })
    ->build();

$dispatcher->dispatch(new Hello('onliner'));

More examples can be found here.

License

Released under the MIT license.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •