Symfony 4 and Drupal

In November 2017, Symfony released its latest major version: Symfony 4! That's great! Right? But what does this mean for Drupal? And more importantly, what does it mean for your Drupal projects?

The Symfony release cycle

First, a little bit of backstory. Symfony has a predictable release cycle: a new minor version (e.g. 3.3) is released every 6 months and a new major version is released every 2 years. The result is that each major version consists of 5 minor versions: 3.0, 3.1, 3.2, 3.3, 3.4 and then 4.0 is released. This repeats over and over again. The last version of a major (e.g. 3.4 or 4.4 in the future) is a long-term support release. You can even see when any version of Symfony will be released on its roadmap.

But, there's something very interesting about the last minor version (3.4) and the next major version (4.0)... they're identical! What?! Yes, the only difference between Symfony 3.4 and Symfony 4.0 is that any deprecated features have been removed. This means that all the features found in 4.0 also exist in Symfony 3.4. That's important for Drupal.

Drupal and Symfony versions

So, what version of Symfony does Drupal use? Actually, that's not quite the correct question to ask. Instead, ask, what version of Symfony does Drupal require and allow?

The current version of Drupal - 8.4 - requires Symfony 3.2.8 or higher, but less than 4.0. In practice, this probably means that your Drupal 8.4 project is using the latest Symfony 3.2.* version. But, you could technically upgrade your Symfony dependencies to version 3.4.

The upcoming version - Drupal 8.5 - will require 3.4 or higher, but still less than 4.0. This means that a Drupal 8.5 project will have all the features of Symfony 4.0, because those features are the same as Symfony 3.4.

So what does the Symfony 4.0 release mean for Drupal? In the short term, nothing! Drupal 8.5 will use Symfony 3.4, which means that you get all of the new features and optimizations.

Allowing Symfony 4.x in Drupal

But, eventually, Drupal will want to upgrade to Symfony 4. When will this happen? It's still being debated. However, Drupal has adopted Symfony's awesome deprecation policy, which includes a backwards-compatibility promise, meaning only changes that are backwards-compatible with previous minor versions (e.g. 8.4 to 8.5) are allowed. This means that it's likely that the first version of Drupal to require Symfony 4 will be Drupal 9.0. When will that come out? I don't think that's known yet. But thanks to the new deprecation policy, the upgrade will be much easier than the past... practically boring by comparison.

So what happens when Symfony 4.1 comes out in May 2018 with new features you want? Will a Drupal 8 project ever be able to use Symfony 4? Maybe. Nothing is guaranteed, but it's possible that, in Drupal 8.6, Drupal will use Symfony 3.4, but allow version 4. If that happens, you could choose to upgrade one or all of the Symfony libraries to 4.

Oh, and also remember one important thing: Symfony is actually a set of about 40 independent libraries (called components). And Drupal's core only relies on some of these. If you want to use another Symfony component (e.g. symfony/workflow), you're free to install that at any version.

The tl;dr new features, less breakage

The tl;dr is this: Drupal is actively upgrading Symfony in core to bring in new features, optimizations and bug fixes. But, unlike in the past (say, Drupal 7 to Drupal 8), this is being done in a way that prevents backwards compatibility breaks. In other words, it's a lot of goodness.

Oh, and if you want to learn Symfony 4 (it's a lot of fun), you can check out our new, free screencasts here on Drupalize.Me or over at KnpUniversity:

Happy Symfonying! Happy Drupaling!


"backwards-compatibility changes are not allowed in minor versions"
This sentence is quite confusing, I would rewrite as: "only backwards compatible changes are allowed" or "backwards compatibility breaks are not allowed"

Add new comment

Filtered HTML

  • Web page addresses and email addresses turn into links automatically.
  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <code class> <ul type> <ol start type> <li> <dl> <dt> <dd><h3 id> <p>
  • Lines and paragraphs break automatically.

About us

Drupalize.Me is the best resource for learning Drupal online. We have an extensive library covering multiple versions of Drupal and we are the most accurate and up-to-date Drupal resource. Learn more