Symfony events: kernel.controller reference
20 November 2022 (Updated 20 November 2022)
When is it dispatched
Dispatched after the control has been resolved but before itβs executed.
Use cases
- Initialize things later needed by the controller (e.g., param converters).
- Change the controller entirely.
Example
use Symfony\Component\HttpKernel\Event\ControllerEvent;
public function onKernelController(ControllerEvent $event)
{
// ...
// the controller can be changed to any PHP callable
$event->setController($myCustomController);
}
List event listeners
php bin/console debug:event-dispatcher kernel.controller
- Built-in Symfony Events β Symfony docs
- Symfony events: kernel.request reference
- Symfony events: kernel.controller reference
- Symfony events: kernel.controller_arguments reference
- Symfony events: kernel.view reference
- Symfony events: kernel.response reference
- Symfony events: kernel.finish_request reference
- Symfony events: kernel.terminate reference
- Symfony events: kernel.exception reference
Tagged:
Symfony
Thanks for your comment π. Once it's approved, it will appear here.
Leave a comment