onliner / command-bus
PHP easy to use command bus.
Installs: 15 088
Dependents: 2
Suggesters: 0
Security: 0
Stars: 6
Watchers: 9
Forks: 1
Open Issues: 2
Requires
- php: ^8.0
- php-amqplib/php-amqplib: ^2.12 || ^3.0
- psr/container: ^1.0 || ^2.0
- psr/log: ^1.1 || ^2.0
Requires (Dev)
- phpstan/phpstan: ^1.10
- phpunit/phpunit: ^8.5|^9.0
README
This is easy to use PHP command bus implementation.
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.