net_bazzline / php_component_event_handler
此包已被废弃,不再维护。没有推荐替代包。
此自由项目旨在提供一个通用且干净的 PHP 事件处理器组件。
0.0.1
2016-09-15 20:26 UTC
Requires
- php: >=5.3.3
- net_bazzline/php_component_event: ^0.0.1
This package is auto-updated.
Last update: 2020-10-28 13:08:31 UTC
README
自2020年9月28日起,此存储库已移至“存档状态”。如果您对此感兴趣,请联系我。
通用事件处理器组件
此自由项目旨在提供一个通用且干净的 PHP 事件处理器组件。
当前主分支的构建状态由 Travis CI 跟踪:@todo:
@todo: 查看 openhub.net。
安装
手动
mkdir -p vendor/net_bazzline/php_component_event_handler
cd vendor/net_bazzline/php_component_event_handler
git clone https://github.com/bazzline/php_component_event_handler .
使用 Packagist
composer require net_bazzline/php_component_event_handler:dev-master
优点
核心思想是将“事件发生”与“对事件发生的反应”分开。通过使用关键字“emit”描述“事件发生”,而使用关键字“dispatch”描述“对事件发生的反应”来实现分离。
最终结果可能是使用运行时实现、基于REST、基于数据库或基于BUS。
此存储库仅包含真正的基础。为了避免您安装和分发您永远不会使用的代码,真正的实现是在其他存储库中完成的。
术语
- 发射器 - 发送事件
- 分发器 - 通知监听器已发送此事件
- 监听器 - 当事件发生时执行操作
功能
- 使用通用事件类以增加互操作性
- 具有专用包中真实实现的通用事件发射器(总线、数据库、REST、运行时)
未排序的想法
- 工作流程
- 构建事件
- 发射器->emit(Event) (...运行时、基于REST、数据库、总线)
- ImmediateEmitter(运行时和总线)
- DeferredEmitter(基于REST和数据库)
- DispatcherInterface->dispatch(Event)
[...]
With Event Sourcing we also capture each event. If we are using a persistent store the events will be persisted just the same as the ship objects are. I find it useful to say that we are persisting two different things an application state and an event log.
[...]
Event Sourcing also raises some possibilities for your overall architecture, particularly if you are looking for something that is very scalable. There is a fair amount of interest in 'event-driven architecture' these days. This term covers a fair range of ideas, but most of centers around systems communicating through event messages. Such systems can operate in a very loosely coupled parallel style which provides excellent horizontal scalability and resilience to systems failure.
[...]
链接
- https://martinfowler.com.cn/eaaDev/EventSourcing.html
- https://martinfowler.com.cn/eaaDev/DomainEvent.html
- https://martinfowler.com.cn/eaaDev/EventCollaboration.html
- https://martinfowler.com.cn/eaaDev/AgreementDispatcher.html
- https://martinfowler.com.cn/eaaDev/ParallelModel.html
- https://martinfowler.com.cn/eaaDev/RetroactiveEvent.html
- https://github.com/illuminate/events
- https://github.com/othercodes/rest
- https://github.com/positivezero/rest
- https://github.com/hoaproject/Event
- https://github.com/fruux/sabre-event
- https://github.com/JBZoo/Event
- https://github.com/joomla-framework/event
- https://github.com/thinframe/events
历史
- 即将推出
- @待办
- 事件循环
- 承诺
- 协程
- 在 audit.log 或 event.log 中记录事件(独立的包)
- 讨论
- 优先支持(默认值为49,0表示最不重要,99表示最重要)
- 可以停止事件传播
- @待办
- 0.0.1 - 发布于2016年9月15日
结语
如果你喜欢,请给它加星标 :-). 需要它的话,请添加问题。喜欢它的话,请拉取补丁。使用它的话,请写一篇博客。如果你深爱它,请捐款 :-]。