senenhermida.docs
  • Design Patterns
  • SOLID
  • PHP History
    • Late static binding
  • PHP Questions
  • Symfony
    • Service container
    • Event dispatcher
    • Security
    • Validation
    • Serializer
    • Http Kernel Component
    • Cache component
    • Symfony history
  • Algorithms
  • Leetcode
    • Codility
  • My CV
Powered by GitBook
On this page
  • Http Kernel Component
  • HttpKernel Component
  1. Symfony

Http Kernel Component

PreviousSerializerNextCache component

Http Kernel Component

HttpKernel Component

The workflow of a request

  1. The kernel.request Event

  2. Resolve the Controller

  3. The kernel.controller Event

  4. Getting the Controller Arguments

  5. Calling the Controller

  6. The kernel.view Event

  7. The kernel.response Event

  8. The kernel.terminate Event

Locating Resources

The HttpKernel component is responsible of the bundle mechanism used in Symfony applications. One of the key features of the bundles is that you can use logic paths instead of physical paths to refer to any of their resources (config files, templates, controllers, translation files, etc.)

This allows to import resources even if you don't know where in the filesystem a bundle will be installed. For example, the services.xml file stored in the Resources/config/ directory of a bundle called FooBundle can be referenced as @FooBundle/Resources/config/services.xml instead of __DIR__/Resources/config/services.xml.

This is possible thanks to the method provided by the kernel, which transforms logical paths into physical paths:

Copy

$path = $kernel->locateResource('@FooBundle/Resources/config/services.xml');

locateResource()