In Symfony 6.1 we've added lots of new features to the Symfony Profiler. We already highlighted the new Serializer profiler panel in a previous blog post. In this two-part series we're going to highlight the other new profiler features.

Checking if Profiler is Enabled

Bilge
Contributed by Bilge in #45265

The Symfony Profiler can be disabled entirely or programmatically to adapt it to your needs. If it's disabled, you might still have services that collect information for it, even if that information will be later discarded.

That's why in Symfony 6.1 we've added a new isEnabled() method to the main profiler object. Use that method to check if you should collect information or if you should instead skip that collection to improve performance.

Displaying Inherited Security Roles

Jonathan Scheiber
Contributed by Jonathan Scheiber in #44284

Symfony security allows you to define hierarchical roles. That's why users in your application usually have more roles than the ones granted explicitly to them. In Symfony 6.1 we're improving the debug toolbar to display inherited roles in addition to the regular roles:

Symfony 6.1 Debug Toolbar displaying inherited security roles

Better Email Debugging

Thomas Lallement
Contributed by Thomas Lallement in #45765

In dev environment it's common to send all emails to the same address, regardless of their original address, to ease their debugging. In Symfony 6.1 we've improved the profiler to display both the to email address and the recipient, if it exists (it's taken from the envelope of the message):

Symfony 6.1 Profiler displaying all the email recipients
Daniël Brekelmans
Contributed by Daniël Brekelmans in #44917

If some email message includes file attachments, the profiler lists the name of those files. In Symfony 6.1 we've improved this feature so you can also download the file attachments. This will help you debug many issues related to the generation of those files.

Published in #Living on the edge