Skip to main content

June 2, 2014

What Symfony Components are Going into Drupal 8?

Thought by Jesus Manuel Olivas, Drupal 8 Solutions Engineer

In the first post of this series, we looked at why Symfony is being included in Drupal 8, and what that means for longtime Drupal developers. Now that we've considered the implications, just what is getting incorporated into Drupal?

Drupal is not using Symfony as a full stack framework. Rather, it is taking advantage of specific components. This post is essentially a list of these components with a link and a brief description for each.

  • ClassLoader Provides tools to autoload your classes and cache their locations for performance. Whenever you reference a class that has not been required or included yet, PHP uses the autoloading mechanism to delegate the loading of a file defining the class.
     
  • DependencyInjection Allows you to standardize and centralize the way objects are constructed and passed to another objects using constructor or methods in your application.
     
  • EventDispatcher Implements the Mediator Pattern, decoupling a Producer from a Consumer. Handling the communication between each other, allowing Producer and Consumer to be independent with each other but still can maintain communication through the mediator.
     
  • HTTPFoundation Defines an object-oriented layer for the HTTP specification. This component replaces the default PHP global variables and functions by an object-oriented layer.
     
  • HTTPKernel Provides a structured process for converting a Request into a Response by making use of the EventDispatcher.
     
  • Routing (Drupal 8 is using the CMF Routing which extends from Symfony Routing) Maps an HTTP request to a set of configuration variables which can be passed as arguments from the URL to a controller or callback function.
     
  • Serializer Meant to be used to turn objects into a specific format (XML, JSON, YAML) and the other way around.
     
  • Validator Enables specifying validation rules for classes using XML, YAML, PHP or annotations, which can then be checked against instances of these classes.
     
  • YAML Parses YAML strings to convert them to PHP arrays. It is also able to convert PHP arrays to YAML strings.

In the next blog post, I will introduce you to other tools and concepts you will be using when working with Drupal 8. In the meantime, stop by our booth and say hello! I'll be there with the rest of the staff to celebrate the opening of DrupalCon tonight!