SymfonyCon Vienna 2024 is just around the corner! December 3-6th 2024 Book your seat now


Interview: Symfony 7 in a Nutshell with Nicolas Grekas

· Elise Hamimi · 4 minutes to read
Interview Nicolas Grekas Symfony 7 EN

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 new latest features in Symfony 7 and what you should prepare for when upgrading to it.

What is the philosophy of Symfony 7?

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

The new Long-Term Support version Symfony 6.4 will be available at the same time as Symfony 7. In fact, Symfony releases a new major version every two years that is identical to the Long-Term Support version, except that deprecated features have been removed. Symfony thus manages to combine stability and innovation.

Stability, because the framework's development processes are regulated, allowing for easy version upgrades. There are no major disruptions between versions; it is an evolution in continuity. Symfony 7 follows the guiding line that has been the backbone of our developments since the release of Symfony 2 in 2012.

At the same time, Symfony promotes innovation and provides developers with the latest advancements in technology. It is the community that contributes and ensures a “cleaning” of code every two years, releasing functions that are no longer used.

Symfony 7 once again successfully bridges the gap between being both a proven technology and a cutting-edge framework.

What are the major new features in Symfony 7?

With each new major version of Symfony, several components are added to the framework. Here are the new components:

Clock, which enhances the ability to test code under time constraints.

Webhook, to define your own webhooks and respond to remote events.

Scheduler, which triggers and sends messages according to a predefined schedule.

HTML Sanitizer, which allows creating HTML code securely and conforming to specifications.

AssetMapper, to write modern JavaScript and CSS without using a bundler.

As always, there is a particular focus on improving performance and security. Symfony 7 adheres to the standards in terms of security. For example, increasing the requirements of the HTTPS protocol, now that everyone has sufficiently updated clients. Symfony 7 also allows the implementation of CHIPS cookies which are more respectful of user privacy.

Finally, Symfony 7 is a version that requires PHP 8.2 and fully exploits the new features of PHP 8.2.

What changes concretely for developers?

Symfony 7 brings a lot of modernity and will enable developers to create more innovative features.

Thanks to PHP 8.2, attributes are now very present in Symfony 7. They appeared with the release of PHP 8, already existed in Symfony 6, and will be even more present in Symfony 7. Attributes allow a developer to express the application's needs much more effectively than before. The code is now much more expressive. Attributes therefore bring productivity gains and an increased elegance of the code. Developing in Symfony becomes more enjoyable than before and that is an aspect close to our hearts. Indeed, a developer who enjoys writing code is more effective and satisfied.

New attributes are arriving in Symfony 6.4 and others to come. For example, the Autowire and Autoconfigur attributes allow Symfony to better understand how to use the classes developed in the application.

Symfony also utilizes the type declaration system permitted by the latest PHP versions as much as possible. The readability of the code is improved and more explicit. Static analysis tools work better, allowing problems to be identified earlier in the development process.

All these new features significantly enhance the development experience on Symfony.

How does Symfony 7 evolve with respect to PHP? and other Open Source projects?

Symfony is increasingly involved in the development of PHP. As seen, Symfony 7 uses all the potential of PHP 8.2 innovations to offer functions adapted to their time. The latest versions of PHP also develop in connection with the evolution of Symfony.

In the past two years, PHP has made significant progress with the creation of the PHP Foundation, in which Symfony is involved. PHP is further structuring itself, and Symfony has engaged in these efforts by aiding the development of the PHP language itself.

In its relations with other Open Source projects, Symfony 7 remains true to the same principles since Symfony 2. That is, providing useful and decoupled components for Open Source projects. Today, Symfony is a founding project for many large Open Source projects, like Drupal, Shopware, or Sulu.

What are your tips for upgrading to Symfony 7?

Upgrading from a previous version of Symfony to Symfony 7 is a simplified operation. Since Symfony 3 introduced the continuous migration path, version upgrades between major Symfony versions are guided.

Here's the checklist to upgrade to Symfony 7:

Update your project with Symfony 6.4

Ensure that the code does not generate any deprecation notices

Switch to PHP 8.2

Upgrade to Symfony 7, ensuring everything functions and making final adjustments as needed.

For most users, Symfony 7 contains no deprecations that would disrupt everything in the code. The version upgrade should therefore be relatively simple and inexpensive. The effort required is moderate.

When to switch to Symfony 7?

As soon as possible! In fact, Symfony 7 will be a stable version upon its release. It will not be more experimental than other versions.

Switching immediately to Symfony 7 means being ready now for subsequent iterations. Backward compatibility continues between minor versions, such as from Symfony 7.0 to Symfony 7.1. Upgrading to Symfony 7 right away provides an opportunity to benefit from improvements that will be offered in Symfony 7.1, 7.2, etc.

The only difference between Symfony 7 and Symfony 6.4 is that Symfony 7 will remove deprecated functions. Just after the release of Symfony 7, libraries that users may use in a project might not be ready to work with Symfony 7. These issues will be progressively resolved thanks to community contributions right after the release of Symfony 7.

Don’t wait for someone else to update your dependencies! Contribute now in Open Source to ensure that your libraries are compatible with Symfony 7 and you will benefit the whole community.

What will Symfony 7 bring to a company?

Symfony 7 is a projection into the future that will be written under this new version of the framework.

For a company, migrating to Symfony 7 means bringing more comfort in application development thanks to Symfony 7's improvements. It also means “paying off part of its technical debt.” That means more agility in the future and not finding yourself in a situation where the entire code needs to be rewritten one day. For companies questioning why they should migrate to Symfony 7, they can find all the good reasons to choose Symfony in this white paper. Migrating to Symfony is choosing a proven technology and innovation at the same time.

How to support the release of new Symfony versions and Open Source contributions?

Symfony is an Open Source project that is the result of contributions from individuals and companies participating in these evolutions. The future of Symfony is only written thanks to the collective sum of all contributions.

Contributions are made in several ways:

by giving feedback, i.e., raising issues or wishing for new features

by contributing to the code with pull requests

by improving the documentation

by financially supporting the most active Symfony contributors on Github

Companies can also contribute to Symfony by funding several sponsorship packages: a major or minor version of the framework (as SensioLabs and Private Packagist do with Symfony 6.4), a specific component, the weekly newsletter “A Week of Symfony,” the book “The Fast Track to Symfony 7,” and of course, the Symfony conferences.

All these sponsorships give companies visibility in the Symfony community. If you are interested, you can contact us via this link.

Thank you, Nicolas!

Need help migrating to Symfony 7? SensioLabs supports you with its Upgrade Offer. Contact us on sensiolabs.com to discuss further.

Image