Fast Forward Event Dispatcher
fast-forward/event-dispatcher
is a lightweight event dispatcher package for PHP applications that want
PSR-14 interoperability, Symfony subscriber compatibility, and straightforward Fast Forward container
integration.
This package is especially useful when you want to:
- dispatch plain PHP objects as domain or application events;
- keep listener registration explicit and testable;
- mix PSR-14 listeners, Symfony subscribers, named events, and attribute-based listeners in one application;
- add wildcard listeners for cross-cutting concerns such as logging, metrics, or audit trails;
- observe listener failures through an
ErrorEventwhile still rethrowing the original exception.
Useful links
- GitHub repository: https://github.com/php-fast-forward/event-dispatcher
- Issue tracker: https://github.com/php-fast-forward/event-dispatcher/issues
- Packagist: https://packagist.org/packages/fast-forward/event-dispatcher
- PSR-14 specification: https://www.php-fig.org/psr/psr-14/
- Symfony Event Dispatcher contracts: https://github.com/symfony/event-dispatcher-contracts
What Makes This Package Different
- It dispatches typed object events through any PSR-14 listener provider.
- It can also dispatch the same event a second time as a named wrapper, which makes string-based event names possible without giving up object events.
- It ships a service provider that automatically classifies configured listeners into the right runtime strategy.
- It includes a small wildcard-provider base class for cross-cutting observers that should see every dispatched object.
- It supports Symfony
EventSubscriberInterfaceandAsEventListenerattributes without turning your whole application into a Symfony application.
Documentation Map
Contents
- Getting Started
- Usage Guide
- Advanced Topics
- API Reference
- Links
-
FAQ
- What kind of events can I dispatch?
- Do I need a framework to use this package?
- When should I use the Fast Forward service provider?
- What is the difference between typed events and named events?
- Can I use Symfony subscribers here?
- Can I use AsEventListener attributes?
- How do I stop propagation?
- Why is my exception still thrown even though I registered an error listener?
- How do I log every dispatched event?
- Can I register closures and functions?
- Can I register my own ListenerProviderInterface implementation?
- Why does the same listener sometimes run twice?
- Does this package provide async events or message queues?
- Compatibility