-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
Description
The wiki mentions Events as a candidate for generic PHP packages. (ie removal from the core).
When looking on packagist, there are several big (in terms of # downloads) event-related packages:
- symfony/event-dispatcher (54 million downloads, lots of dependencies)
- zendframework/zend-eventmanager (11 million, no dependencies, good documentation, last commit < 6 months ago)
- evenement/evenement (3.1 million, no dependencies, few docs, last commit > 3 years ago)
- illuminate/events (2.5 million, some dependencies, last commit < 6 months ago)
- league/event (1.9 million, no dependencies, good documentation, last commit > 1 year ago)
I've had good experiences with packages from The PHP League as well as their handling of contributions.
Zend EventManager seems to be well documented, maintained and its has a high number of installs.
Going through the documentation for ZendEventManager I feel it supports everything that Yii needs, and more. One thing it explicitly does not support that Yii does is listing event handlers; at Zend they removed this in the latest version stating that there is no real use case for it.
Yii often checks for event handlers before firing an event:
if (...hasEventHandlers()) {
trigger the event.
}
I feel we could live without it.
The specific library to use could even be made configurable by the developer. We could define a simple interface that is used by Component for use within Yii. Then anyone can implement a connector and use the library of their choice.