Symfony for Drupal Developers for Drupal 8, 9, and 10

Symfony for Drupal Developers

What will you learn

  • Which Symfony components Drupal uses
  • The purpose of each component
  • How Drupal customizes the components
  • Where to find documentation


Beginning with Drupal 8, Modern Drupal replaced several internal subsystems with components from the Symfony project. Drupal 10 now uses Symfony 6 as a dependency and requires PHP 8.1. While it's not necessary to know these components inside and out to be a competent Drupal developer, Drupal provides an interesting set of use cases for their implementation. By understanding what they are, where they come from, and Drupal customizes them, you’ll have a better foundation to understand Drupal. And you’ll learn transferable skills that will come in handy as you encounter other PHP-based projects that use Symfony components.


Drupal includes these Symfony packages, called components, in its codebase. When you install Drupal locally, you will find these in your project’s vendor directory. Drupal’s internal classes, located in core/lib include customizations to key components.

Each component links to its official Symfony documentation.

Get started

Begin with these blog posts in our Spotlight on Symfony series. This will give you a high-level overview of the components in Drupal.

The Symfony components documentation is an excellent resource for understanding each individual component. Some components are used in Drupal without any customization at all, while some have a high degree of customization, like the Routing system.

Web frameworks all have similar basic functionality requirements. Fundamentally they are responsible for managing incoming HTTP requests, making sense of them somehow, and responding to them. See How Drupal Turns a Request into a Response to see this process in detail.

More information

Every web framework, including Drupal, has basically the same job: provide a way for developers to map URLs to the code that builds the corresponding pages. Drupal uses Symfony's HTTPKernel component. Kernel events are dispatched to coordinate the following tasks:

  • Process the incoming request
  • Figure out what to put on the page
  • Create a response
  • Deliver that response to the user's browser

Knowing a bit more about how Drupal handles the request-to-response workflow will help you better understand how to use routes and controllers to create your own custom pages or deal with authentication, access checking, and error handling in a Drupal module.

In this tutorial we'll:

  • Walk through the process that Drupal uses to convert an incoming request into HTML that a browser can read
  • See how the Symfony HTTPKernel helps orchestrate this process
  • Learn about how the output from a custom controller gets incorporated into the final page

By the end of this tutorial, you should be able to describe the process that Drupal goes through to convert an incoming request for a URL into an HTML response displayed by the browser.

The HttpKernel component handles the heavy lifting for the request and response handling. It makes use of the HttpFoundation component to provide a more developer-friendly object-oriented layer for manipulating the types of data that is handled at the HTTP layer.

Once the incoming HTTP request has been parsed the framework needs to figure out how to respond. This is the job of the Routing and EventDispatcher components. Our Overview: Routes, Controllers, and Responses tutorial is a great place to continue learning about this process.

More information

Do you know some PHP and want to learn how to create a custom page at a custom URL in Drupal? You're in the right place.

Every web framework has the same job: provide a way for developers to map user-accessible URLs with code that builds the page. Routes, controllers, and responses are what module developers use to create pages at custom URLs in a Drupal site.

In this tutorial, we'll:

  • Define what routes, controllers, and responses are.
  • Explain the routing workflow that Drupal uses to match a URL to a route.
  • Define routing system-related terms like parameter and upcasting.

By the end of this tutorial, you should be able to explain how a developer uses routes, controllers, and responses to create custom pages in a module.

The EventDispatcher and the use of the Dependency Injection components represent design patterns decisions that are incredibly common among other frameworks. What Are Events? provides an overview for how Drupal makes use of the EventDispatcher pattern.


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

Dependency injection is a design pattern commonly used in object-oriented software architectures in order to support Inversion of Control.

Drupal 8, 9, and 10
More information

Drupal uses events to allow modules and various subsystems to communicate with one another in an object-oriented manner. Understanding how the Event API works is critical knowledge for all module developers. In this tutorial we'll:

  • Explain what events are
  • Discuss the use case for subscribing to events
  • Give an example use case for dispatching events

By the end of this tutorial you should be able to explain what events are, understand when to use them in your own code, and know where to learn more about how to do so.

The rest of the components in core can be considered utility components. They provide very specific functionality and usually don't require much additional customization. A good example of this is the Yaml component which handles loading, parsing and writing YAML files. Learn more about these types of components on our Utility Functions and Classes topic page and in our blog post on Utility Components.

Drupal 8, 9, and 10
More information

In Drupal’s core library there are a number of utility functions and classes that, as a module developer, you will find make your task easier or less tedious.

Our Symfony topic page also includes a round-up of both Drupalize.Me and external resources about Symfony in Drupal:


Drupal 8, 9, and 10
More information

Symfony is a set of reusable PHP components, and a framework for building PHP applications. Drupal makes use of various Symfony components.

“Drupalize.Me has trained thousands of Drupalistas. Their video lessons help to address our constant need for more Drupal talent. Drupal needs training like this to support its growth.”
Dries Buytaert
Drupal Founder and Project Lead
Photo of Dries Buytaert
“They’re easy to understand. They’re thorough. They’re funny. They’re always entertaining, and it makes it easy to learn parts of Drupal and how you can integrate it into your workflow and learn more and have a good time doing it.”
Roger Carr
Drupalize.Me Member
Photo of Roger Carr
“The mission of the Drupal Association is to foster and support the Drupal software project, the community, and its growth. Drupal education, like that provided by Drupalize.Me, is important to this mission.”
Megan Sanicki
Former Exec. Director, Drupal Assoc.
Photo of Megan Sanicki


Am I required to sign a contract?
No. You can purchase a membership and/or cancel any time. Drupalize.Me is a pay-as-you-go service.

Can I preview tutorials before joining?
Yes! Just navigate to our tutorial library. Our free tutorials are labeled with a green "FREE" tag.

Can I watch videos on my mobile device?
Yes! Drupalize.Me is a responsive site and can be accessed in the browser on any mobile device. More FAQs