Are you making use of the event handling system like Symfony event handler, Aura.Signal, Zend event manager or any other in your core framework?
Are you using signal/events before they hit the action class ( controller action ) ?
I have a feeling it will be good to have an event handling system in core of a framework.
The basic idea is to call a signal
- before a route is checked
- before dispatching
- before sending the response
Currently I have one or two examples in mind,
-
Caching the entire response before sending and on the next request before we check a route we can send the same response. But in the current world of Varnish, I am not sure it will be good to do so also.
-
Before hitting a route, check whether the user is authenticated or not. Redirect to a different page, especially helpful when all the pages need authentication.
-
Access seems good to have in action class having some sort of signal handler.
I would like to hear your use case for having an event handler in core of a framework in which your application is using it extensively that cannot be done other way.
Willing to share? Please comment below or send an email to my gmail account : kthari85
Thank you.
In some of cases you described here (1, 2) I use AOP instead of event handler for BEAR.Sunday. Consumer and called method are completely agnostic about these "cross cutting concerns" (=cache, auth, or log) These are bound dynamically in runtime context.