t4web/event-subscriber
最新稳定版本:2.0.0
Composer 安装命令:
composer require t4web/event-subscriber
包简介
ZF2 Module. One place for manage application events
关键字:
README 文档
README
ZF2 Module. One place for manage application events.
Instalation
Add to your composer.json:
"t4web/event-subscriber": "~1.0.0"
And to your config/application.config.php:
'modules' => [ // ... 'T4web\EventSubscriber', // ... ],
Problem
As usual your event handlers everywhere, and you (or team member) don't know what will be executed
when you see this code $this->getEventManager()->trigger($event);. You spend many time with
Crtl+F in whole project.
Solution
It just recommendation (or team rule) - describe all your handlers in one place in your
module.config.php:
'events' => [ 'Zend\Mvc\Application' => [ 'render' => [ SomeListenerOne::class, ], ], 'Users\User\Infrastructure\Repository' => [ 'create' => [ SomeListenerTwo::class, SomeListenerThree::class, ], ], 'Users\User\Infrastructure\Repository' => [ 'status:change' => [ CreateTimelineEntryListener::class, UserNotifyListener::class, ExpireUserTokensListener::class, AdminLogListener::class, ], ], // ... 'EventIdentifier' => [ 'EventName' => [ 'Callback1', // can be invokable class 'Callback2', // ... 'CallbackN', ], ], ],
T4web\EventSubscriber - read this config and attach every handler in described event.
统计信息
- 总下载量: 7.53k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2016-02-19