Event Helpers
The package exposes one helper.
event()
php
function event(): EventManagerReturns the shared EventManager:
- registers
EventManager::classin DI if it is not registered yet - returns
Di::get(EventManager::class)
Every event() call in the same app container returns the same manager, so a listener registered in one file is seen by a dispatch() anywhere else.
The helper loads together with the other framework helpers, at the start of the boot, which is why app and module helper files can already call it.
