localzet / events
In-process event dispatch with exact and prefix listeners.
Fund package maintenance!
Requires
- php: >=8.0
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
In-process event dispatch with exact and prefix listeners.
Status and compatibility
Listener exceptions are collected in emit() results. A false response stops propagation; halt returns the first non-null result.
Dependencies
php:>=8.0
Installation
composer require localzet/events
Example
require __DIR__ . '/vendor/autoload.php'; use localzet\Events; $id = Events::on('user.*', static fn(array $data, string $event): string => $event); $responses = Events::emit('user.created', ['id' => 1]); Events::off('user.*', $id);
listeners() returns matching callbacks; list() returns registered listeners with their names and IDs. Exact and prefix listeners run in registration order. Class-based instance handlers must support construction without arguments; static callbacks are not instantiated.
Development checks
composer validate --strict
composer install
composer dump-autoload --optimize --strict-psr
composer lint
composer test
Installation, lint and autoload checks do not establish end-to-end behavior or production readiness.
Historical usage notes need verification against the current API.
Author and license
Ivan Zorin (localzet), creator@localzet.com, https://www.localzet.com.
Source: https://github.com/localzet/Events. AGPL-3.0-or-later; LICENSE. Original copyright and third-party licenses remain applicable.