Andreas Hucks
SensioLabs Deutschland
CTO
Symfony has a wide user base today. Most who work with Symfony on a daily basis have configured their own services, are fluent in configuring routing and validators. But what is actually going on under the hood? What happens when the configuration is parsed? What is a cache warmup? What happens to a request before hitting your controller? How does the HttpKernel work? Andreas will help us gain insight into the inner workings of the Symfony framework. If you have used
Symfony, but have never built a compiler pass, a cache warmer, or are wondering how exactly the container is built, this talk is for you.
36. GetResponseEvent
class GetResponseEvent extends KernelEvent
{
public function getResponse()
{
return $this->response;
}
public function setResponse(Response $response)
{
$this->response = $response;
$this->stopPropagation();
}
kernel.request
42. FilterControllerEvent
class FilterControllerEvent extends KernelEvent
{
public function getController()
{
return $this->controller;
}
public function setController(callable $controller)
{
$this->controller = $controller;
}
kernel.controller
43. ControllerListener
class ControllerListener implements EventSubscriberInterface
{
public function __construct(Reader $reader)
{
$this->reader = $reader;
}
public function onKernelController(FilterControllerEvent $event)
{
$controller = $event->getController();
// read annotations for class and method
$request = $event->getRequest();
foreach ($configurations as $key => $attributes) {
$request->attributes->set($key, $attributes);
}
kernel.controller
55. Customize!
• Customize for every exception type you like
• Redirect for some errors
• “were you looking for…” suggestions on 404 pages
• Custom alerts
• … ?
57. FilterResponseEvent
class FilterResponseEvent extends KernelEvent
{
public function getResponse()
{
return $this->response;
}
public function setResponse(Response $response)
{
$this->response = $response;
}
kernel.response