innmind / event-bus-bundle
此包已被弃用,且不再维护。未建议替换包。
事件总线包
2.0.0
2017-02-12 13:29 UTC
Requires
- php: ~7.1
- innmind/event-bus: ~2.0
- symfony/config: ~3.0
- symfony/dependency-injection: ~3.0
- symfony/http-kernel: ~3.0
- symfony/yaml: ~3.0
Requires (Dev)
- phpunit/phpunit: ~6.0
This package is auto-updated.
Last update: 2022-02-01 13:00:09 UTC
README
master |
develop |
---|---|
这是 innmind/event-bus
的 Symfony 集成,简化了事件总线的堆叠。
安装
composer require innmind/event-bus-bundle
在您的 AppKernel.php
中添加以下行
//app/AppKernel.php class AppKernel extends Kernel { public function registerBundles() { $bundles = array( // ... new Innmind\EventBusBundle\InnmindEventBusBundle, ); // ... } // ... }
使用方法
$container->get('innmind_event_bus')->dispatch(new MyEvent);
为了分发事件,您需要将监听器定义为带有标签 innmind_event_bus.listener
的服务,并带有属性 listen_to
,其中将包含命令 FQCN。