Tomahawk uses the Symfony3 Event Dispatcher as it is quite powerful and easy to use.
To access the event dispatcher just add the following parameter to the construct method of your Controller
and it will get injected in through the Service Container.
You can even access it through the container by doing
For more information on how to use it please read the Symfony3 docs.
You can listen on the following events for the Kernel (
Kernel events are all under the namespace
||GetResponseEvent||The REQUEST event occurs at the very beginning of request dispatching.|
||GetResponseForExceptionEvent||The EXCEPTION event occurs when an uncaught exception appears.|
||GetResponseForControllerResultEvent||The VIEW event occurs when the return value of a controller is not a Response instance.|
||FilterControllerEvent||The CONTROLLER event occurs once a controller was found for handling a request.|
||FilterControllerArgumentsEvent||The CONTROLLER_ARGUMENTS event occurs once controller arguments have been resolved.|
||FilterResponseEvent||The RESPONSE event occurs once a response was created for replying to a request.|
||PostResponseEvent||The TERMINATE event occurs once a response was sent.|
||FinishRequestEvent||The FINISH_REQUEST event occurs when a response was generated for a request.|