Symfony 5.2 was released in November 2020, and integrates many new helpful features into the framework. You will find here our short overview of the best new features to know about this minor version.
Symfony recently 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.
As Nicolas Grekas explained us 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 new key 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 making it available for 24-bit colors. In total, you can now use more than 16 million different colors to get all the colours 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 should 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 expected soon to take full advantage of the new features of PHP 8.
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
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.
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 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.
Find more details about all the new features of Symfony 5.2 on Fabien Potencier’s publication.