Download the PHP package spiral-packages/league-event without Composer
On this page you can find all versions of the php package spiral-packages/league-event. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download spiral-packages/league-event
More information about spiral-packages/league-event
Files in spiral-packages/league-event
Package league-event
Short Description The League Event bridge for Spiral Framework
License MIT
Homepage https://github.com/spiral-packages/symfony-event-dispatcher
Informations about the package league-event
The League Event bridge for Spiral Framework
Requirements
Make sure that your server is configured with following PHP version and extensions:
- PHP 8.1+
- Spiral framework 3.0+
Installation
You can install the package via composer:
After package install you need to register bootloader from the package.
Note If you are using
spiral-packages/discoverer
, you don't need to register bootloader by yourself.
Usage
Event
An event can be represented by a simple class:
Dispatching an event:
Listener
A listener can be represented by a simple class with a method that will be called to handle the event.
The method name can be configured in the Listener attribute parameter or in the configuration file (__invoke
by default):
Registering a listener via a config file:
Registering a listener via an attribute:
The attribute can be used without additional parameters. Then the method name __invoke
and the event from the type
of the method parameter will be used:
All available options:
The attribute can be used directly on the method, then the method name can be omitted:
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
License
The MIT License (MIT). Please see License File for more information.