Event Dispatcher

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 Symfony\Component\EventDispatcher\EventDispatcherInterface and it will get injected in through the Service Container.

You can even access it through the container by doing $container->get('event_dispatcher').

For more information on how to use it please read the Symfony3 docs.

Available Events

You can listen on the following events for the Kernel (Symfony\Component\HttpKernel\KernelEvents).

Kernel events are all under the namespace Symfony\Component\HttpKernel\Event.

Event Event Class Description
KernelEvents::REQUEST GetResponseEvent The REQUEST event occurs at the very beginning of request dispatching.
KernelEvents::EXCEPTION GetResponseForExceptionEvent The EXCEPTION event occurs when an uncaught exception appears.
KernelEvents::VIEW GetResponseForControllerResultEvent The VIEW event occurs when the return value of a controller is not a Response instance.
KernelEvents::CONTROLLER FilterControllerEvent The CONTROLLER event occurs once a controller was found for handling a request.
KernelEvents::CONTROLLER_ARGUMENTS FilterControllerArgumentsEvent The CONTROLLER_ARGUMENTS event occurs once controller arguments have been resolved.
KernelEvents::RESPONSE FilterResponseEvent The RESPONSE event occurs once a response was created for replying to a request.
KernelEvents::TERMINATE PostResponseEvent The TERMINATE event occurs once a response was sent.
KernelEvents::FINISH_REQUEST FinishRequestEvent The FINISH_REQUEST event occurs when a response was generated for a request.