getwarp/command-bus

Simple and extendable command bus

3.1.0 2022-08-22 13:41 UTC

This package is auto-updated.

Last update: 2024-12-15 17:28:47 UTC


README

getwarp/command-bus

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.