Symfony 7.4 and 8.0: Double Release Cleans Up Codebase

Symfony 7.4 and 8.0 bring the same features, bid farewell to XML configuration, and introduce a new, array-based PHP format for projects.

listen Print view

(Image: nattaphol phromdecha/Shutterstock.com)

4 min. read
Contents

With Symfony 7.4 and 8.0, the Symfony core team has released two versions simultaneously, sharing the same feature set but differing in their structure. 7.4 includes all features marked as deprecated (deprecations) from the 7.x series, while 8.0 omits them. This simplifies the transition once applications no longer use outdated interfaces.

The double release marks the completion of the previous development phase and opens a new cycle. Developers can choose between a long-term supported LTS version and a regular major version that comes without legacy baggage.

One of the most striking changes in Symfony 7.4 concerns the configuration system. The XML format is now officially considered deprecated, meaning Symfony 8.0 will no longer support it. In recent versions, XML was disabled by default but could be manually enabled. YAML remains the default format, and configuration can also be done entirely in PHP as an alternative.

A tool is available for XML-based bundles that automatically converts configuration to PHP. In parallel, Symfony is introducing new JSON schemas for YAML files. These enable, according to the blog post, improved autocompletion and validation in modern development environments (IDEs).

Videos by heise

As part of the modernization effort, the development team has revised PHP configuration in Symfony 7.4. The Config-builder classes used since version 5.3 are being replaced by the team with an array-based format. This approach utilizes Array Shapes, which are recognized by tools like PHPStan or PhpStorm. The goal is to enable better static analysis, type checking, and autocompletion.

The new format is similar to YAML in structure but is written directly in PHP. According to the blog post, it is easier to maintain and aims to facilitate integration into PHP-based workflows in the long term. Although YAML is still recommended, the innovation is considered a step towards greater convergence between the framework and the language. In line with this, PHP 8.5 was recently released, with new possibilities for typing and analysis – which supports the direction of Symfony's changes: both developments aim to make configurations more verifiable and development tools more integrated into the code flow.

The Symfony core team recommends updating projects to version 7.4 first and cleaning up all deprecations before switching to version 8.0. The blog post suggests that the best method for identifying deprecated items is to run your own test suite:

$ php bin/phpunit --display-deprecations

The output lists deprecations – both direct ones from your code and indirect ones via bundles or libraries. Those without extensive test coverage can use simple smoke tests to identify affected areas. Third-party bundles also need to be checked and adjusted accordingly. Older projects, in particular, that still rely on XML or the earlier PHP configuration syntax are impacted by the changes and should adapt their dependencies early on.

Symfony 7.4 is an LTS (long-term support) version with bug fixes until November 2028 and security updates until November 2029. Version 8.0 receives regular support for eight months but allows for rapid upgrades to 8.1, 8.2, and subsequent versions. The Symfony team recommends following the regular cycle for most projects to gradually align with new features and PHP versions.

Further information is available in the blog post about the double release: Symfony 7.4 and Version 8.0.

(mdo)

Don't miss any news – follow us on Facebook, LinkedIn or Mastodon.

This article was originally published in German. It was translated with technical assistance and editorially reviewed before publication.