Prepare Yourself for Symfony 6.4 and Symfony 7.0
Symfony 6.4 and Symfony 7.0 will be released at the same time at the end
of November 2023. Both will have the exact same set of features, but also
some important differences. Keep reading to know how to prepare your projects
to update to these new Symfony versions.
Symfony releases a minor version (6.0, 6.1, 6.2, etc.) every six months, at
the end of May and at the end of November. These minor versions contain lots of
new features, but once released, they don’t add new features.
For example, Symfony 6.3 was released in May 2023 with lots of new features.
The following patch versions (which are released monthly) will only contain bug
fixes: 6.3.1 contains the same features as 6.3.0 and some bug fixes; 6.3.2 contains
the same features as 6.3.0 and 6.3.1 and more bug fixes; etc.
In addition to new features and bug fixes, software projects also make changes like
renaming a config option, adding or removing a method argument, etc. If Symfony
made changes like those and released a new version, your applications would just
stop working after upgrading.
Instead, Symfony takes a different approach based on deprecations. When making
a change, Symfony keeps the old behavior (marking it as deprecated) and adds support
for the new behavior. This makes Symfony to generate a log message whenever your
application uses a deprecated feature.
Certain deprecations introduce a small performance degradation. If Symfony added
deprecations continuously, at some point this degradation would be very noticeable.
That’s why we remove all deprecations every two years with the release of a new
major version. In practice:
Symfony 6.0 (Nov. 2021): it has no deprecations
Symfony 6.1 (May 2022): it has some deprecations
Symfony 6.2 (Nov. 2022): it has 6.1 deprecations + new deprecations
Symfony 6.3 (May. 2023): it has 6.1 and 6.2 deprecations + new deprecations
Symfony 6.4 (Nov. 2023): it has 6.1, 6.2 and 6.3 deprecations + new deprecations
Symfony 7.0 (Nov. 2023): it has no deprecations
Symfony 7.0 = Symfony 6.4 – deprecations. Both versions have the exact same features,
but 6.4 includes the code related to all the 6.x deprecations and 7.0 doesn’t include
any of that code.
Symfony 7.0 doesn’t include any deprecated features, so you can’t use it if your
application still uses any of those deprecated features. That’s why the upgrade
must follow these steps:
Upgrade your project from your current Symfony version to Symfony 6.4
Check the deprecated features used in your application
Fix all those deprecations
You are now ready to upgrade to Symfony 7.0
The best way to check the deprecated features used in your application is to
run tests with the Symfony test pack and the php bin/phpunit command.
In the output you’ll see deprecations divided in two groups:
Direct deprecations: these are the deprecations that you can fix yourself;
they are caused by your own application code;
Indirect deprecations: you can’t fix these quickly; they are caused by
bundles, packages and libraries in vendor/ which are using deprecated features;
Please, report those deprecations to the repositories of each project so they can fix them.
If you don’t have tests in your application and don’t have time to write good
tests, consider adding smoke tests in your Symfony application. You can write
those very quickly and they will help you reporting the deprecations.
There are thousands of Symfony bundles and your application will probably use
some of them. Bundles usually need some updates to prepare for major Symfony releases.
Consider helping the volunteers behind each bundle by reporting deprecations and
helping solve them. Let’s make the entire Symfony ecosystem ready for Symfony 7.0!
Besides deprecations, an important difference between Symfony 6.4 and 7.0 is that
6.4 is a long-term support (LTS) version and 7.0 is a regular version:
LTS: fixes bugs for 3 years and security bugs for 4 years;
Regular: fixes bugs for 8 months and security bugs for 8 months too.
In theory, an LTS version looks better because of the extended support. However,
in practice you must also consider the following:
If you choose to stay in Symfony 6.4 LTS: you’ll get bug fixes until November 2026
and security fixes until November 2027; however, you won’t get any new Symfony
features for 2 years, until you upgrade to the next LTS version (7.4) in November 2025.
If you choose to upgrade to Symfony 7.0: you’ll get bug/security fixes only until July 2024,
but you’ll be able to upgrade to 7.1 (May 2024), 7.2 (Nov. 2024), 7.3 (May 2025)
and 7.4 (Nov. 2025) without much effort, so you’ll get all the new Symfony features
and continuous bug/security support. Moreover, you can fix deprecations regularly
when upgrading between minor versions, instead of fixing all deprecations at once
when upgrading to the next major version.
The official Symfony recommendation is to use regular versions whenever possible.