Download the PHP package yiisoft/yii-event without Composer
On this page you can find all versions of the php package yiisoft/yii-event. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download yiisoft/yii-event
More information about yiisoft/yii-event
Files in yiisoft/yii-event
Package yii-event
Short Description Yii Event
License BSD-3-Clause
Homepage https://www.yiiframework.com/
Informations about the package yii-event
Yii Event
This package is a configuration wrapper for the yiisoft/event-dispatcher package. It is intended to make event listener declaration simpler than you could ever imagine. All you need is to use any PSR-11 compatible DI container.
Requirements
- PHP 8.1 or higher.
Installation
The package could be installed with Composer:
General usage
DI configuration
You can find default configuration in the config directory:
- PSR-14 interfaces.
- di-console.php contains the configuration for the
Yiisoft\EventDispatcher\Provider\ListenerCollection
. - params-console.php contains parameters for
web
andconsole
configurations.
All these settings will be used automatically in projects with the yiisoft/config.
If you have custom events
configuration group name, for example events-api
, redefine it in the eventsConfigGroup
params key.
params.php
Event configuration example
The configuration is an array where keys are event names and values are array of handlers:
The dependency resolving is done in a lazy way: dependencies will not be resolved before the corresponding event will happen.
Configuration checker
To help you with event listener configuration validation there is the ListenerConfigurationChecker
. It is converting
your whole listener config to actual callables at once to validate it. It is intended to be used in development environment
or in tests since it is a resource greedy operation in large projects. An InvalidEventConfigurationFormatException
will be thrown if your configuration contains an invalid listener.
Usage example:
Documentation
- Internals
If you need help or have a question, the Yii Forum is a good place for that. You may also check out other Yii Community Resources.
License
The Yii Event is free software. It is released under the terms of the BSD License.
Please see LICENSE
for more information.
Maintained by Yii Software.
Support the project
Follow updates
All versions of yii-event with dependencies
psr/container Version ^1.0|^2.0
yiisoft/event-dispatcher Version ^1.0
yiisoft/friendly-exception Version ^1.0
yiisoft/injector Version ^1.0