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 7 is a Drupal 11 dependency
Symfony has been upgraded to 7.1.1 in Drupal 11.0.0. (PHP 8.3 is required in Drupal 11.)
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
Confidence
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
External resources
-
Symfony: The Fast Track
- Official documentation for Symfony 5 and 6.
-
Symfony (official) (symfony.com)
- The official home of the Symfony project. Learn about the Symfony framework, components, philosophy, and community.
-
Symfony Documentation (symfony.com)
- The official source of Symfony documentation.
-
SymfonyCasts (symfonycasts.com)
- Our friends at SymfonyCasts have a number of video courses covering major Symfony versions.
Components included in Drupal
As of Drupal 10.2.0, Symfony components now require version 6.4.
- HttpFoundation
- HttpKernel
- EventDispatcher
- Filesystem
- Finder
- Console
- DependencyInjection
- Polyfill Iconv
- Process
- Routing
- Mime
- Serializer
- Mailer -- Symfony Mailer has been added as a new dependency in Drupal 10.2, with the aim of replacing the existing mail system in a future release.
- Validator
- Yaml