Download the PHP package sympress/event-dispatcher without Composer
On this page you can find all versions of the php package sympress/event-dispatcher. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download sympress/event-dispatcher
More information about sympress/event-dispatcher
Files in sympress/event-dispatcher
Download sympress/event-dispatcher
More information about sympress/event-dispatcher
Files in sympress/event-dispatcher
Vendor sympress
Package event-dispatcher
Short Description MU plugin for class-based WordPress events, listeners, and subscribers.
License GPL-2.0-or-later
Package event-dispatcher
Short Description MU plugin for class-based WordPress events, listeners, and subscribers.
License GPL-2.0-or-later
Please rate this library. Is it a good library?
Informations about the package event-dispatcher
Event Dispatcher
Standalone WordPress MU-plugin for Symfony-style class-based events, listeners, and subscribers on top of native WordPress hooks and filters.
Requirements
- WordPress 6.9
- PHP 8.5
Design Goals
- Symfony-like listener and subscriber API
- PSR-14 compliant dispatcher and listener provider contracts
- Class-based WordPress action and filter events
- Immutable event value objects
- Native WordPress hook bridge with one callback registration per event class
- Container-friendly bootstrap for
SymPress\Kernel\App - Enterprise-focused QA with PHPUnit, PHPStan, PHPCS, and PHP CS Fixer
Installation
- Place the package in
wp-content/mu-plugins/event-dispatcher/. - Ensure Composer autoloading is available.
- Add a root MU loader file because WordPress does not autoload subdirectories.
Registering Subscribers
Filter Strategy
Filter sind bereits implementiert.
- Das erste native Filter-Argument ist der Payload des Events.
- Filter-Events sind immutable Value Objects.
- Listener mutieren nie in-place, sondern geben bei Änderungen eine neue Event-Instanz zurück.
- Der letzte Event-Stand wird über
toHookResult()zurück in den nativen WordPress-Filter geschrieben.
Kurz gesagt: apply_filters() bleibt nach außen WordPress-kompatibel, intern arbeitest du aber mit sauberen immutable Events.
Registering Attribute-Based Listeners
Use Cases
1. WordPress Filter: MIME Types erweitern
2. WordPress Action: Typed save_post
3. Attribute-Based Hook Service
4. Pure Domain Event Without WordPress Hook
5. Invokable Attribute Listener for Domain Events
Runtime Model
EventSystemowns the singleton bootstrap lifecycle.HookEventDispatcherimplements PSR-14 dispatching and listener resolution plus the WordPress hook bridge.HookEventDispatcher::register()resolvesAsEventListenerandAsEventSubscriberon classes and methods.AbstractActionEventmaps native actions to typed event objects.AbstractFilterEventmaps native filters to immutable event value objects; listeners return a new event instance when they change data.- Filter listeners should return the same event unchanged or a new event instance of the same class.
- Subscribers follow the Symfony event subscriber format.
Development
License
This package is licensed under GPL-2.0-or-later.
All versions of event-dispatcher with dependencies
PHP Build Version
Package Version
The package sympress/event-dispatcher contains the following files
Loading the files please wait ...