getwarp/command-bus

Simple and extendable command bus

3.0.2 2022-06-12 11:11 UTC

This package is auto-updated.

Last update: 2022-08-12 11:34:47 UTC


README

Simple and extendable command bus

GitHubPackagistInstallationUsage

Installation

Via Composer

$ composer require getwarp/command-bus

Usage

use Warp\CommandBus\CommandBus;
use Warp\CommandBus\Mapping\MapByStaticList;

class MyCommand
{
}

class MyCommandHandler
{
    public function handle(MyCommand $command)
    {
        // Do your job to handle a command
    }
}

$commandBus = new CommandBus(new MapByStaticList([
    MyCommand::class => [MyCommandHandler::class, 'handle'],
]));

$commandBus->handle(new MyCommand());

Change log

Please see CHANGELOG for more information on what has changed recently.

Contributing

Report issues and send pull requests in the main Warp repository. Please see contributing guide and code of conduct for details.

Credits

License

The MIT License (MIT). Please see license file for more information.