Module Development

Symfony for Drupal 8, 9, and 10

Symfony is an application framework written in PHP that can be used to create robust web applications. The Symfony framework consists of numerous reusable components, many of which Drupal includes in its core library. Learning Symfony will help you advance your skills as a web developer as well as give you a greater understanding of how things work “under the hood” in Drupal.

What is Symfony?

Symfony is a set of PHP Components, a Web Application framework, a Philosophy, and a Community — all working together in harmony.

What are Symfony Components?

A set of decoupled and reusable components on which the best PHP applications are built, such as Drupal, phpBB, and eZ Publish.

Symfony 6 is a Drupal 10 dependency

Drupal 10 now uses Symfony 6 as a dependency and requires PHP 8.1.

As of Drupal 10.2.0, Symfony components now require version 6.4.

Symfony 3 to 4.4 in Drupal 9

Drupal 9's release was planned to ensure security support for the most important third-party dependency, Symfony. Since Symfony 3 will be end-of-life in November 2021, Drupal 9 is updated to Symfony 4.4. While Symfony 5 is now available, the disruption of jumping from Symfony 3 to 5 was too great for Drupal 9's release; however, we will try to ensure Drupal 9 is as forward-compatible with Symfony 5 as possible.

Example tasks

  • Create PHP web applications using best practices
  • Create routes and controllers
  • Create and use special PHP objects called services
  • Organize code into reusable chunks


Drupalize.Me includes resources for learning earlier versions (2, 3, and 4) of Symfony produced by our friends Ryan Weaver—Symfony documentation lead—and Leanna Pelham at SymfonyCasts (formerly KnpUniversity). Drupal 10 uses Symfony 6, Drupal 9 uses Symfony 4, and Drupal 8.3 and earlier use Symfony 3 components. The official Symfony documentation is the canonical source and should be consulted in conjunction with other training materials.

Drupalize.Me resources

Module Development, Backend and Infrastructure
Drupal 8, 9, and 10
Posted on Friday, January 19, 2024 - 16:47 by Blake Hall

For over a decade, Drupal has been using Symfony Components. In 2015, with the release of Drupal 8, these components became a part of Drupal's core software. It's possible to build complex Drupal sites without worrying about what these components do. But learning about the system we're using will make us better developers of Drupal sites and other PHP applications.

In this first part of a 3-part series, we'll explore how Symfony helps Drupal with its HttpKernel component. We'll look at the component itself and how Drupal uses it to coordinate the request/response cycle.

Posted on Wednesday, January 24, 2024 - 19:54 by Blake Hall

In Part 2 of our exploration of Symfony components in Drupal, we focus on the event dispatcher.

The event dispatcher is a tool that enables the application to communicate across objects by subscribing to and listening for events. It achieves this by creating a directory for various event types, and the corresponding registered listeners for each event type. When a specific type of event occurs, the code that has registered a listener for that event is invoked. If you're familiar with the Mediator and Observer design patterns you might recognize similarities here.

Posted on Tuesday, January 30, 2024 - 21:04 by Blake Hall

In this installment of our series on Symfony's role in Drupal, we're focusing on the Routing component. Even if it may seem simple looking from the outside, routing in Drupal is a complex task with lots of customized parts. The routing component's job is to match incoming requests to the correct controller, which is then responsible for building the response. Let's take a high-level glance at how Drupal has built upon Symfony's Routing component.

Posted on Wednesday, January 31, 2024 - 18:03 by Blake Hall

We've made it to the final blog post (for now?) in our spotlight on Symfony in Drupal. In this blog post, we'll take a look at Symfony's utility components. We're using this term to group together Symfony components that provide useful functionality. It's a great idea to familiarize yourself with these. You can make use of them in your own modules, or bring them into other PHP application code.


Drupal 8, 9, and 10
More information

Events are one of the ways that module developers can alter or extend Drupal without modifying existing code.


Drupal 8, 9, and 10
More information

Services are objects that encapsulate the code for performing specific tasks in a reusable and decoupled way.


Drupal 8, 9, and 10
More information

Drupal's Routing API maps the URL of an incoming request to the code responsible for generating the content that is rendered in response.


Not sure where to start? Our guides provide useful learning tracks for all skill levels.

Navigate guides

External resources

Components included in Drupal

As of Drupal 10.2.0, Symfony components now require version 6.4.