innmind / command-bus
此包已被弃用且不再维护。未建议替代包。
命令总线库
4.2.0
2021-02-14 15:00 UTC
Requires
- php: ~7.4|~8.0
- innmind/di: ^1.0
- innmind/immutable: ~3.0
- innmind/reflection: ~4.0
- psr/log: ^1.0
- ramsey/uuid: ^3.5
Requires (Dev)
- innmind/coding-standard: ^1.1
- phpunit/phpunit: ~9.0
- vimeo/psalm: ~4.4
README
一个简单的库,用于将命令路由到其处理器,接口允许您组合总线以添加功能。每个处理器都必须是一个 可调用
对象。
安装
composer require innmind/command-bus
示例
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;