Symfony 5.2 curated new features
Symfony 5.2.0 RC1 has just been released. As for any other Symfony minor release,
our backward compatibility promise applies and this means that you should be
able to upgrade easily without changing anything in your code.
During the last couple of months, we've blogged about the great 5.2 new
features. I highly recommend you to read the articles about Symfony 5.2 as
they contain the major changes for this new version:
- Pseudo-localization translator: Symfony 5.2 adds support for pseudo-localization, a software testing method used for testing internationalization.
- True colors in the console: In Symfony 5.2, Console applications can use 24-bit colors to define the text and background colors.
- Doctrine types for UUID and ULID: Symfony 5.2 provides new Doctrine types to help you work with UUID/ULID values in your entity properties.
- Translatable objects: Symfony 5.2 introduces new TranslatableMessage objects which hold all the information needed to make full translations, simplifying both your backend code and your templates.
- PHP 8 attributes: Symfony 5.2 will support PHP 8 attributes/annotations to define routes and required dependencies.
- Session profiling: Symfony 5.2 will provide session profiling in the debug toolbar and the profiler, showing you all the session usages and their full details, including PHP backtraces.
- Simpler DataCollectors: Symfony 5.2 introduces a new AbstractDataCollector class that configures everything about DataCollectors, so you no longer need to manually register services for them.
- Async cache recomputing: In Symfony 5.2 the recomputing of cache values can be done asynchronously thanks to the new integration with the Messenger component.
- DKIM email authentication: Symfony 5.2 adds support for DKIM, an email authentication mechanism designed to reduce email phishing and spam.
- Retryable HTTP client: In Symfony 5.2, the HTTP client can retry all the failed HTTP requests automatically.
- Uid serialization and validation: Symfony 5.2 includes a Uid normalizer to serialize/deserialize UUIDs and ULIDs. It also introduces a new validation constraint to validate ULIDs.
- Form mapping callbacks: In Symfony 5.2 you can use PHP callbacks to get/set the form field values from/into the related object/array.
- Controller argument attributes: In Symfony 5.2 you can use PHP 8 attributes in the controller arguments to turn them into other objects.
- Form testing asserts: Symfony 5.2 adds new asserts (assertFormValue() and assertCheckboxChecked()) to simplify the form tests .
- Shared locks: Symfony 5.2 adds support for shared locks, which is a synchronization primitive used to solve one of the readers–writers problems.
- Console signals: Symfony 5.2 introduces support for handling and responding to signals (e.g. SIGINT, SIGTERM, SIGUSR1) in your console commands.
- Rate Limiter component: Symfony 5.2 introduces a new Rate Limiter component to allow you implement protection measures such as limiting the number of HTTP requests or login attempts.
- Front controller configuration: In Symfony 5.2 the behavior of the front controller can be modified with configuration options, without having to edit the index.php file.
- Login Throttling: Symfony 5.2 includes a new "login throttling" feature to mitigate brute-force attacks against login forms.
- Form field helpers: Symfony 5.2 introduces new form field helpers to get each field part value without any HTML code around it.
- Constraints as PHP attributes: In Symfony 5.2, you can use PHP 8 attributes to define the validation constraints.
- Login links: Symfony 5.2 provides support for "login links" (or "magic links") which allow users to fully authenticate in your application by clicking on a specially crafted link.
- Semaphore component: Symfony 5.2 introduces a Semaphore component to complement the existing Lock component and provide access to a shared resource to multiple concurrent processes.
- Notifier improvements: In Symfony 5.2 the Notifier component is easier to debug and provides integration with lots of new third-party services.