[Drupal] What is Symfony in Drupal 8

| | 1 min read

Symfony in Drupal 8 changes the structure to MVC with the help of Symfony. Symfony is an open source framework. It is created using object oriented concepts.

HttpFoundation and HttpKernel HttpKernel are Symfony components. All web interactions start with request, and it ends with response. The function of HttpKernel is converting the request to response. The HttpKernel is attached with event listeners. The name of each of the "kernel" event is defined as a constant on the KernelEvents class. Every event have their own objects like kernel.request, kernel.controller, kernel.view, kernel.response,kernel.finish_request,kernel.terminate, kernel.exception ;

EventDispatcher The EventDispatcher is the central point of Symfony's event listener system. The EventDispatcher is changed by invoking hooks. It allows your application to communicate with each other by dispatching and listening.

YAML The Symfony YAML components parses convert YAML string to PHP arrays and vice-versa. Human friendly data serialization standard for all programming languages.

ClassLoader ClassLoader is another component from Symfony. Class loader is an autoloader for class files. Class loader implements PSR-0 class loader. It loads only classes of a specific namespace or all namespaces.

Routing There are 3 parts in Routing section. They are RouteCollection, RequestContext and UrlMatcher. The route collection means defining routes, RequestContext means information about the request and UrlMatcher is pointing request to route.