Attribute-based listener discovery in this package is performed by the service-provider integration. If you instantiate the dispatcher manually, attributes are not scanned automatically.
Installation
Requirements
The package currently requires:
- PHP
^8.3 - Composer
It also depends on a few standard interoperability packages:
psr/event-dispatcherfor PSR-14 contractspsr/containerfor container interoperabilitypsr/logfor the bundled error logging listenersymfony/event-dispatcher-contractsfor Symfony-compatible dispatch signatures
Install With Composer
composer require fast-forward/event-dispatcher
What You Get After Installation
After installation, the package gives you:
FastForward\EventDispatcher\EventDispatcher: the concrete dispatcherFastForward\EventDispatcher\Event\NamedEvent: a wrapper for explicit event namesFastForward\EventDispatcher\Event\ErrorEvent: a dispatchable event representing listener failuresFastForward\EventDispatcher\Event\EventandStoppableEventTrait: helpers for stoppable flowsFastForward\EventDispatcher\ListenerProvider\EventSubscriberListenerProvider: a Symfony subscriber adapterFastForward\EventDispatcher\ServiceProvider\EventDispatcherServiceProvider: Fast Forward container integration
Choose Your Integration Style
There are two common ways to use the package.
- Direct construction
- Use this when you already have a
ListenerProviderInterfaceimplementation, or when you want a very small setup with no container involved. - Fast Forward container integration
- Use this when you want to register listeners declaratively and let the package classify subscribers, attributes, custom providers, and callables for you.
Recommended First Read
If this is your first contact with the library, read these pages next: