Symfony 5.4/6.0 curated new features
Symfony 5.4.0 and 6.0.0 have been released a few days ago. As for any other Symfony release, our backward compatibility promise applies and this means that you should be able to upgrade easily to 5.4 without changing anything in your code.
During the last couple of months, we’ve blogged about the great 5.4 new features. I highly recommend you to read these articles about Symfony 5.4 as they contain the major changes for this new version:
Console Autocompletion: Symfony 5.4 will add autocompletion to the Console component, allowing commands to autocomplete options, arguments and even their values.
Faster Security Voters: Symfony 5.4 introduces a new interface to make some parts of the security voters cacheable to improve your application performance.
Nested Validation Attributes: Symfony 5.4 will support PHP 8.1 nested attributes in all its validation constraints.
Controller Changes: In Symfony 5.4 we’re deprecating some controller shortcuts to encourage other better practices.
Route Aliasing: Symfony 5.4 will allow to define route aliases, which are useful to rename and/or deprecate legacy routes.
PHP Enumerations Support: Symfony 5.4 will support PHP 8.1 Enumerations in Form, Serializer, Dependency Injection and VarExporter components.
New Validation Constraints: Symfony 5.4 adds new validator constraints to validate CIDR notations and CSS colors.
Configurable Exceptions: In Symfony 5.4 you can configure the log level and the HTTP status per class.
Filesystem Path Class: Symfony 5.4 includes a new Path class in the Filesystem component to manipulate file/dir paths in a consistent manner.
Redesigned Profiler Logs: In Symfony 5.4 we’ve redesigned the logs section of the Symfony profiler to make information easier to find and understand.
Language Negotiation: Symfony 5.4 adds new config options to better handle the Accept-Language HTTP header in your applications.
Translation Improvements: In Symfony 5.4 you can use translatable objects for form help and for translation parameters. In addition, translation messages now integrates with GitHub Actions.
DependencyInjection Improvements: Symfony 5.4 adds features such as autowiring of union and intersection types, improved TaggedIterator and TaggedLocator attributes and autoconfiguration of methods and properties.
Messenger Improvements: Symfony 5.4 adds the option to configure handlers with PHP attributes, adds a new way to get worker metadata, allows to reset container services between messages and allows you to handle messages in batches.
Profiler improvements: In Symfony 5.4 you can enable the profiler conditionally, you can see more security-related information in the profiler and you can even preview the rendered HTML emails.
Notifier integrations: Symfony 5.4 adds new integrations for the Notifier component: sms77, smsc.ru, Mailjet, Telnyx, MessageMedia, Yunpian, Amazon SNS, TurboSMS and Expo Notification.
Serializer improvements: Symfony 5.4 allows to configure the serializer globally, to use your own serializer for Messenger and to collect all denormalization errors related to PHP types.
Misc. features (part 1): Symfony 5.4 adds a new strict mode for assets, new options for YAML liner, some UX improvements in error pages, a new Nil ULID class and new string functions.
Misc. features (part 2): Symfony 5.4 adds new methods to DomCrawler, improves gitignore support in Finder and introduces a new command to debug env vars.
Misc. features (part 3): Symfony 5.4 allows using longer RateLimiter intervals, simplifies the creation of constraint errors, allows to lock files when appending to them and introduces a PhpStan extractor for PropertyInfo.