SymfonyCon Vienna 2024 is just around the corner! December 3-6th 2024 Book your seat now


What you need to know about Symfony 5.2

· Grégoire Thelliez · 2 minutes to read
slide_0

Symfony 5.2 was released in November 2020, and integrates many new helpful features into the framework. Here is our short overview of the best new functionalities to keep in mind.

Symfony 5.2 was released in November 2020, and integrates many new helpful features into the framework. Here is our short overview of the best new functionalities to keep in mind.

Shortly after its 15th anniversary, Symfony released its new version: Symfony 5.2.0. The Symfony Core Team and the whole Symfony community keep improving the framework according to the Symfony roadmap. This new minor version of Symfony includes many new helpful features.

As Nicolas Grekas explained in his interview about Symfony 5, a large number of new features appear with each major or minor evolution of the framework. Some minor releases can also introduce substantial new features.

The main new features in Symfony 5.2

Let’s explore the main features that have drawn our attention:

True colors in the console

The Symfony Console component provides a default style for your command output, but you can also apply custom styles and colors. Symfony 5.2 improves this feature because it supports 24-bit colors. In total, you now have at your disposal more than 16 million different colors to get all the colors of the rainbow within your console controls.

PHP 8 attributes

PHP 8 is a big change with new basic features like built-in attributes, also known as annotations. Symfony 5.2 includes support for PHP 8 attributes to define the required routes and dependencies. If you already use annotations, the transition will be seamless.

PHP enters a new golden age with the release of PHP 8, and Symfony is fully compatible. These attributes are just the beginning as new ones are planned soon to take full advantage of the new features of PHP 8.

Rate Limiter

A rate limiter controls how often an event (for example, an HTTP request or connection attempt) is allowed to happen. You can use rate limiting as a defensive measure to protect services from excessive usage. Symfony 5.2 introduces a new RateLimiter component so you can add those protections to your applications.

How SensioLabs developers contributed

We are proud to announce that a few developers from SensioLabs’ technical department participated in this new minor version of Symfony. Two key contributions came from SensioLabs developers: Simple DataCollectors and Session Profiling by Laurent Voullemier and Mathias Arlaud.

Simpler DataCollectors

The introduction of a new AbstractDataCollectors class simplifies the creation of custom data collectors in Symfony 5.2. From now on, the framework automatically saves this data collector and uses it from the next request. You don’t need to register services manually anymore.

Session Profiling

Session profiling is a great improvement in Symfony 5.2. Thanks to it, you can display all the information related to the current request session in the debug toolbar. Besides, the profiler now offers a new section called “Session” in the request/response panel. It also displays session metadata (for example, creation date, lifetime, etc.), session attribute names and values, and full details on how the session happened.

Congratulations to them for their contributions! Many developers from SensioLabs regularly contribute to Symfony: as the creator of Symfony, SensioLabs remains, of course, very close to the framework and encourages developer contributions from its team.

Image