texdc / momento
A library for domain events
Installs: 14
Dependents: 0
Suggesters: 1
Security: 0
Stars: 2
Watchers: 1
Forks: 0
Open Issues: 1
pkg:composer/texdc/momento
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: 2025-09-27 19:59:04 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); } // ... }