texdc / momento
A library for domain events
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-12-21 16:20:40 UTC
README
Simple domain event library inspired by Vaughn Vernon's book Implementing Domain Driven Design, and some of his code samples.
Event Handlers
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); } // ... }