texdc / momento
v2.0.0
2017-10-14 20:44 UTC
Requires
- php: ~7.0
- mathiasverraes/classfunctions: ~1.0
Requires (Dev)
- phpmd/phpmd: @stable
- phpmetrics/phpmetrics: @stable
- phpunit/phpunit: ~6.0
- squizlabs/php_codesniffer: @stable
This package is not auto-updated.
Last update: 2024-09-14 15:05:58 UTC
README
受Vaughn Vernon的《实现领域驱动设计》一书和其部分代码示例启发的简单领域事件库。Vaughn Vernon's book Implementing Domain Driven Design, and some of his code samples.
事件处理器
namespace My\Event; use texdc\momento\AbstractEventHandler; use texdc\momento\EventInterface; final class Handler extends AbstractEventHandler { protected static $validEventTypes = [ FooEvent::TYPE, BarEvent::TYPE, ]; public function __invoke(EventInterface $anEvent) { $type = $anEvent->eventType(); $this->guardValidEventType($type); call_user_func([$this, $type], $anEvent); } // ... }