Download the PHP package waffle-commons/event-dispatcher without Composer
On this page you can find all versions of the php package waffle-commons/event-dispatcher. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download waffle-commons/event-dispatcher
More information about waffle-commons/event-dispatcher
Files in waffle-commons/event-dispatcher
Package event-dispatcher
Short Description Event Dispatcher component for Waffle framework.
License MIT
Informations about the package event-dispatcher
Waffle Event Dispatcher Component
Release:
0.1.0-beta4|CHANGELOG.mdPSR Compliance: PSR-14 (Psr\EventDispatcher\EventDispatcherInterface,ListenerProviderInterface,StoppableEventInterface)
A minimal, attribute-driven PSR-14 dispatcher. The dispatcher itself is final readonly and stateless; the listener provider stores the listener map and supports priority ordering and #[AsEventListener] attribute discovery.
๐ฆ Installation
๐งฑ Surface
| Class | Role |
|---|---|
Waffle\Commons\EventDispatcher\Dispatcher\EventDispatcher |
final readonly PSR-14 dispatcher. Walks listeners, respects StoppableEventInterface. |
Waffle\Commons\EventDispatcher\Provider\ListenerProvider |
Listener registry. Manual registration via addListener(), or attribute scanning via register($object). |
Waffle\Commons\EventDispatcher\Attribute\AsEventListener |
PHP 8 attribute marking a class or method as a listener. |
Waffle\Commons\EventDispatcher\Event\AbstractStoppableEvent |
Convenience base implementing StoppableEventInterface. |
๐ Manual registration
๐ท๏ธ Attribute-driven registration (#[AsEventListener])
The attribute is declared as:
Method-level โ event class resolved from the parameter type-hint
Class-level โ first public non-constructor method is the handler
๐ Stoppable events
The dispatcher honours isPropagationStopped() and breaks out of the listener loop.
๐ PHP 8.5 features used
final readonly class EventDispatcherโ the dispatcher itself is immutable.- Constructor property promotion with explicit visibility on listeners.
- Typed properties + parameters throughout.
- Inheritance walks via native
get_parent_class()(not reflection caches), so listener resolution against parent event types isO(depth)without warm-up cost.
๐งญ Architectural boundary (mago guard)
An active dependency perimeter is enforced on every CI run by vendor/bin/mago guard (bundled into composer mago; zero baselines). The rules live in mago.toml under [guard.perimeter] โ a forbidden use statement fails the build, not a reviewer.
Production code under Waffle\Commons\EventDispatcher may depend only on:
Waffle\Commons\EventDispatcher\**โ itselfWaffle\Commons\Contracts\**โ the shared contracts package, the only Waffle dependency permittedPsr\**โ PSR interfaces (PSR-14)@global+Psl\**โ PHP core and the PHP Standard Library
Test code under WaffleTests\Commons\EventDispatcher is unrestricted (@all). Structural rules are guarded too: interfaces must be named *Interface, Exception\** classes must end in *Exception, and any Enum\** namespace may hold only enum declarations.
Contract-first, component-agnostic by construction: components compose through waffle-commons/contracts, never directly through one another.
๐งช Testing
๐ License
MIT โ see LICENSE.md.
All versions of event-dispatcher with dependencies
psr/event-dispatcher Version ^1.0
waffle-commons/contracts Version self.version