Drupal 8 Symfony

Coming from a Symfony background, Drupal 8 looks like a developers playground. The code you write is less magic, you can override anything, and the debugging tools are amazing. Symfony is a collection of bundled php components - these libraries in turn drive some of the 'core' of D8. For example, some of the Symfony2 components used in drupal: HttpFoundation, HttpKernel, Routing, EventDispatcher, DependencyInjection, and ClassLoader.

This post is the first of a series exploring the integration of Symfony2 into Drupal's next major release, Drupal 8. Part two, 'What Symfony Components are Going into Drupal 8?' can be found here.

Is Drupal 8 harder to learn than previous versions?

If you have been working with and developing Drupal modules for a few years, and now you are trying to learn about all of the Drupal 8 changes, your answer may be a resounding, 'YES.'

The inclusion of Symfony2 components may sound scary, counterintuitive, or otherwise ill-advised. If we have been building the platform core since project started, why are we leaving all of the work done for all past years behind and using third party components? What are we getting in exchange for the time and effort it will take to learn this new way of developing for Drupal?


What are the benefits of using third party components and libraries?

The decision to make such a major change to Drupal's infrastructure and conventions was not made lightly. This move will provide many benefits to Drupal developers:

  • Saves Drupalists time that would otherwise be spent solving problems and writing and maintaining code when that work has already been done by another community of developers.
  • Reduces the need to 'reinvent the wheel' for each project. Symfony provides tools for many of the most common and recurring tasks you perform on every project.
  • Pushes Drupalists to 'get off the island' and replace the NIH (Not invented Here) syndrome with PIE/PFE (Proudly Invented Elsewhere/Proudly Found Elsewhere), using well-tested & maintained projects from outside the Drupal world.
  • Allows us to leave behind some less-than-ideal drupalisms.
  • Shifts focus to features that really add value to Drupal as a product.
  • Encourages Drupalists to learn common patterns and principles that apply beyond Drupal.
  • Promotes decoupling code.
  • Enforces best practices and takes advantage of standards and recommendations like the PHP-FIG standards PSR-0, PSR-3, PSR-4.

What is Symfony?

Based on the words of Fabien Potencier, leader of the Symfony project:

First, Symfony2 is a reusable set of standalone, decoupled, and cohesive PHP components that solve common web development problems.
Then, based on these components, Symfony2 is also a full-stack web framework.

The full article can be found here.

Symfony is often defined as an MVC framework. The MVC pattern allows us to separate components into different layers: Model, View and Controller.

Although Symfony shares some of the concepts of the MVC pattern--such as layer separation--the main goal of the framework is to return a response in a optimized and effective way. Therefore, we may say Symfony2 is an HTTP framework--it’s a Request/Response framework.

Drupal 8 Symfony 3


The Symfony2 community is one of the largest and most active communities in the PHP world. Presently, Symfony components are being used by a lot of open source projects that include Composer, Behat, Doctrine, Drupal, phpBB, and Joomla, to name a few.

Drupal 8 routing wi

As you can see there are many other open source projects using Symfony but Drupal is not adopting it just to follow the flow, this is happening because Drupal wanted to embrace modern PHP development and take advantage of new PHP improvements and standards provided by the latest versions of PHP and Symfony.

Stay tuned!


There are several more posts to come in this series. In my upcoming blog posts, we will look at the specific Symfony components being used by Drupal 8, and other tools and concepts you may need to learn in order to get ready for Drupal 8's pending release.

Ready to jump into Symfony and Drupal 8? We've got a handful of seats left for our Introduction to Symfony2: Getting ready for D8 at DrupalCon Austin. See you there?

Drupal 8 Routing Wi

Fill out the form to learn how FFW can support your needs.

Read next:

Open-source software: A CMO’s competitive advantage

Drupal 8 Symfony

'Should I wait for Drupal 9 to upgrade my Drupal 7 site?'

A why-to and how-to guide from FFW on getting the most out of the measurement tools that integrate with your website.