-
-
Notifications
You must be signed in to change notification settings - Fork 0
EventDispatcher
github-actions edited this page Apr 6, 2026
·
1 revision
Dispatch events through PSR-14 listener providers and optional named wrappers.
This dispatcher resolves listeners for the original event object first. When the event is not already a
- See: \FastForward\EventDispatcher\Event\NamedEvent, it dispatches a named wrapper afterward so listeners registered by string identifier can observe the same event instance.
- Full name:
\FastForward\EventDispatcher\EventDispatcher - This class is marked as final and can't be subclassed
- This class implements:
EventDispatcherInterface - This class is a Final class
See Also:
- \Psr\EventDispatcher\EventDispatcherInterface
Create a dispatcher backed by the provided listener provider.
public __construct(\Psr\EventDispatcher\ListenerProviderInterface $listenerProvider): mixedParameters:
| Parameter | Type | Description |
|---|---|---|
$listenerProvider |
\Psr\EventDispatcher\ListenerProviderInterface | listener provider used to resolve event listeners |
Dispatch an event to all matching listeners.
public dispatch(object $event, string|null $eventName = null): objectStoppable events are returned immediately when propagation has already been halted. When a listener throws during a non-error dispatch, the dispatcher emits an
- See: \FastForward\EventDispatcher\Event\ErrorEvent before rethrowing the original throwable.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$event |
object | event object to dispatch |
$eventName |
string|null | explicit name for the generated {@see \FastForward\EventDispatcher\Event\NamedEvent} wrapper |
Return Value:
the dispatched event instance
Throws:
thrown when a listener failure is not absorbed by an error-event listener