Download the PHP package webware/webware-event without Composer
On this page you can find all versions of the php package webware/webware-event. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download webware/webware-event
More information about webware/webware-event
Files in webware/webware-event
Package webware-event
Short Description Event system for Webware
License BSD-3-Clause
Informations about the package webware-event
webware/webware-event
PSR-14 event system for the Mezzio framework — declarative listener wiring, delegator-based dispatcher injection, and PSR-15 middleware integration.
Installation
Quick Start
1. Register the config provider
Merge Webware\Event\ConfigProvider into your application config (standard Laminas/Mezzio pattern).
2. Register listeners in app config
3. Dispatch events from your services
To inject the dispatcher, wire the EventDispatcherAwareDelegator for each service that implements EventDispatcherAwareInterface:
4. Access the dispatcher in HTTP handlers
The EventDispatcherMiddleware attaches the dispatcher as a request attribute. You must register it in your middleware pipeline to make the dispatcher available to all downstream Middleware/handlers.
Configuration
ConfigProvider keys
| Key | Type | Description |
|---|---|---|
dependencies |
array |
Container aliases & factories for the dispatcher, aggregate, and middleware. |
listeners |
array<class-string, array> |
Event class → listener specs. Merged with app config. |
listener_providers |
array<class-string> |
Additional ListenerProviderInterface FQCNs to attach to the aggregate. |
Listener spec formats
| Format | Example | Behavior |
|---|---|---|
| Class-string | SendEmail::class |
Lazy-resolved from container via LazyListener |
Array with priority |
['listener' => X::class, 'priority' => 100] |
Resolved via PrioritizedListenerProvider |
| Callable | fn(Event $e) => ... |
Attached directly |
Allows an object to carry an event instance. Intended for listeners that need access to the event they're processing.
Middleware
EventDispatcherMiddleware (PSR-15) injects the event dispatcher into the request as an attribute keyed by EventDispatcherInterface::class. Register it in your middleware pipeline to make the dispatcher available to all downstream handlers.
Architecture
Key classes
| Class | Namespace | Role |
|---|---|---|
Event |
Webware\Event |
Concrete event with name, target, params, and propagation control |
ConfigProvider |
Webware\Event |
Dependency wiring and default config |
Configuration |
Webware\Event\Container |
Typed, validated config extraction from the container |
ListenerProviderAggregateFactory |
Webware\Event\Container |
Builds the listener aggregate from config |
EventDispatcherAwareDelegator |
Webware\Event\Container |
Injects the dispatcher into aware services |
EventDispatcherMiddleware |
Webware\Event\Middleware |
PSR-15 middleware for request-scoped dispatch |
EventAwareInterface / EventAwareTrait |
Webware\Event |
Pattern for event-carrying objects |
EventDispatcherAwareInterface / EventDispatcherAwareTrait |
Webware\Event |
Pattern for event-dispatching services |
Development
License
BSD-3-Clause
All versions of webware-event with dependencies
phly/phly-event-dispatcher Version ^1.5.0
webmozart/assert Version ^1.11.0 || ^2.0.0
webware/webware-core Version ^0.1.0