shancept/event
最新稳定版本:v1.0.2
Composer 安装命令:
composer require shancept/event
包简介
Events
README 文档
README
Events allow you to insert custom code into existing code at specific points in execution. You can attach custom code to an event so that when the event fires, the code is automatically executed.
install:
composer require shancept/event
Usage:
first case
- create event class implements EventInterface. Example.
- create event handler class. Example.
- call trigger event at the right place
Event::trigger(new Event()). - subscribe to the event before executing it
Event::listen(SomeClass::class, static function ($event) {}).
second case
- use trait in your class.
- record all events via
EventTrait::recordEvent. - call in the right place:
EventBus::dispatch(). - pass
EventTrait::releaseEventsresult to the "dispatch" function parameter.
统计信息
- 总下载量: 4
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2022-11-24