Interview: Symfony 7 in a Nutshell with Nicolas Grekas

Interview release Symfony 7

Symfony 7 was released today, and as per tradition, SensioLabs interviewed Nicolas Grekas, one of the key contributors to the Symfony Core Team. Find out about the latest features in Symfony 7 and what you should prepare for when upgrading to it.

What is the philosophy behind Symfony 7?

Symfony 7 is first and foremost the culmination of two years of feature development since the last major release, Symfony 6, in late 2021.

The new Symfony 6.4 Long-Term Support release will be available at the same time as Symfony 7. Every two years, Symfony releases a new major version that is identical to the Long-Term Support version, except that the code has been purged of all deprecated features. In this way, Symfony combines stability and innovation.

Stability, because the development processes of the framework are controlled, making it easy to upgrade versions. There’s no major break between versions; it is an evolution with continuity. Symfony 7 builds on the foundation of our development work since the release of Symfony 2 in 2012.At the same time, Symfony encourages innovation and provides developers with the latest advances in technology. It’s the community that contributes and “cleans up” the code every two years, retiring features that are no longer in use.

Symfony 7 once again bridges the gap between being a proven technology and a framework at the forefront of innovation.

What’s new in Symfony 7?

As with every major Symfony release, several new components have been added to the framework. Here are the new components: 

  • Clock, improving the ability to test code under time constraints.
  • Webhook, for defining custom webhooks and responding to remote events.
  • Scheduler, triggering and sending messages according to a predefined schedule.
  • HTML Sanitizer, for safe, standards-compliant HTML code generation.
  • AssetMapper, for writing modern JavaScript and CSS without the need of a bundler.

As usual, our focus has been on improving performance and security. Symfony 7 continues this trend, building upon the foundation that is already in place. It keeps up with the evolution of security protocols, such as the increase in HTTPS requirements, now that most clients are up-to-date. Additionally, Symfony 7 now features CHIPS cookies, which are more considerate of users’ privacy.
Symfony 7 requires PHP 8.2 and optimizes the latest features of PHP 8.2.

Symfony 7 is here

What changes can developers expect with Symfony 7?

The latest version introduces modern features that enable developers to create innovative functionalities.

Thanks to PHP 8.2, attributes are now a prominent feature of Symfony 7. Although originally introduced in PHP 8, they were already present in Symfony 6 and will play an even greater role in Symfony 7. With attributes, developers can express the needs of their application much more effectively than before. Attributes increase productivity and improve code quality. Developing with Symfony is now more enjoyable than ever, which is a top priority for us. A developer who enjoys coding is both more effective and content.

Symfony 6.4 introduces several new attributes, with even more to follow. The Autowire and Autoconfigur attributes, for instance, enable Symfony to more effectively utilize the classes developed within the application.

Symfony maximizes the use of the type declaration system enabled in the latest versions of PHP, resulting in improved and explicit code reading. This improves the performance of static analysis tools, enabling problems to be identified earlier in the development process. All of these new features greatly enhance the experience of developing with Symfony.

How is Symfony 7 progressing in relation to PHP and other Open Source projects?

Symfony is playing an increasingly important role in PHP development. Symfony 7 makes full use of the new features of PHP 8.2, offering the necessary functionality for the next generation of PHP. In turn, the latest versions of PHP are being aligned with the development of Symfony.

In the last two years, PHP has made impressive progress with the formation of the PHP Foundation, with which Symfony is involved. PHP is becoming more organized, and Symfony is contributing to this effort by assisting in the development of the PHP language itself.

In its collaborations with other open-source projects, Symfony 7 has upheld the same principles since Symfony 2: to deliver practical, interoperable components for Open Source projects. Today, Symfony is a pioneering project for numerous prominent Open Source projects, such as Drupal, Shopware, Sulu, and more.

Nicolas Grekas
©les-tilleuls.coop

What are your recommendations for upgrading to Symfony 7?

The process of upgrading from a previous version of Symfony to Symfony 7 is straightforward. Thanks to the introduction of the continuous migration path since Symfony 3, upgrading between major Symfony versions is guided.

Here is a checklist for upgrading to Symfony 7: 

  1. Update your project to Symfony 6.4
  2. Ensure that the code does not generate any deprecation notices
  3. Upgrade to PHP 8.2
  4. Upgrade to Symfony 7, checking that everything is working and correcting any final adjustments.

For the majority of users, upgrading to Symfony 7 won’t lead to any deprecation issues that could disrupt the code. As a result, upgrading should be simple and affordable. The required effort is quite manageable.

When to update to Symfony 7?

As soon as possible! Symfony 7 will be a stable release once it debuts. It won’t be more experimental than other versions.

By transitioning to Symfony 7 now, you will be prepared for future versions. Backward compatibility persists between minor releases, like Symfony 7.0 to Symfony 7.1. Adopting Symfony 7 now lets you profit from the updates that will be supplied in Symfony 7.1, 7.2, and beyond.

The sole disparity between Symfony 7 and Symfony 6.4 is that the former will withdraw deprecated functions. Shortly after its release, certain libraries may prove incompatible with Symfony 7. However, the community will gradually resolve these concerns once Symfony 7 becomes available.

Do not wait for someone else to update your dependencies! Contribute to Open Source now to ensure your libraries are compatible with Symfony 7, and the entire community will reap the rewards.

What benefits will a company gain by adopting Symfony 7?

Symfony 7 is a forward-looking vision for the future of the Symfony framework.

Switching to Symfony 7 brings greater comfort to application development for companies. It “pays off part of your technical debt” and provides greater agility in the future. You won’t risk finding yourself in a situation where you have to rewrite all your code.
For companies wondering why they should migrate to Symfony 7, all the reasons to choose this technology are included in this white paper. Migrating to Symfony means choosing proven technology and innovation simultaneously.

How can you sponsor the release of new versions of Symfony and open source contributions?

Symfony is an Open Source project dependent on the contributions of individuals and companies involved in its development. The future of Symfony is only possible through the collective culmination of all contributions.

There are various ways to contribute, such as:

  • giving feedback to report issues or requests for new features,
  • helping with the documentation,
  • contributing to code through pull requests,
  • or financially supporting the most active Symfony contributors on Github.

Companies can support Symfony by funding various sponsorship packages, such as a major or minor version of the framework (like SensioLabs and Private Packagist have done with Symfony 6.4), a particular component, the weekly newsletter “A Week of Symfony”, the book “The Fast Track to Symfony 7”, and Symfony conferences.

These sponsorships provide companies with visibility within the Symfony community. Contact us via this link if you are interested.

Thanks Nicolas!

Do you need assistance in upgrading to Symfony 7? SensioLabs offers a Version Upgrade solution that can help you. Contact us on sensiolabs.com to start a conversation.