New in Symfony 6.4: Command Profiler
October 20, 2023 • Published by Javier Eguiluz
Symfony 6.4 is backed by:
This is the first article of the series that shows the most important new features introduced by Symfony 6.4 and 7.0 versions.
Symfony 6.4 and Symfony 7.0 will be released simultaneously at the end of November 2023. According to the Symfony release process, both versions will have the same features, but Symfony 7.0 won't include any deprecated features.
The Symfony profiler is one of the favorite Symfony features for most developers. It collects all the information about HTTP requests so you can inspect that data when debugging issues. In Symfony 6.4 (and 7.0) we're improving the profiler so you can also profile console commands.
To do so, add the --profile
option (which is automatically defined by Symfony
in all commands, including yours) when running any command:
1
$ php bin/console --profile app:my-command
If the debug mode is enabled in your application, Symfony will collect information related to the command while running it. When the command finishes (or is interrupted by any signal) you can see its profile in the same Symfony Profiler that you use for HTTP requests.
Tip
If you run the command in verbose mode (-v
), Symfony will display in the
output a clickable link to the command profile (if your terminal supports links).
If you run it in debug verbosity (-vvv
) you'll also see the time and memory
consumed by the command.
The design of the command profiler is similar to the existing HTTP profiler, but we adapted some elements to better fit commands (click the image to enlarge it):
The command profiler includes information such as:
- The full argument/option input information and server configuration such as environment variables;
- The total execution time and memory consumption, including a detailed trace of each event and listener/subscriber run;
- Detailed information about the called and not called listeners;
- Log messages and deprecation messages generated while running the command;
- All the other panels that you're familiar with such as Doctrine queries, sent e-mails, etc.
If the error was interrupted by some signal or failed for some reason, you'll see a slightly different design and contents (click the image to enlarge it):
This is the first big new feature of Symfony 6.4/7.0. In the coming days we'll publish other blog posts for the rest of new features. Stay tuned!
Help the Symfony project!
As with any Open-Source project, contributing code or documentation is the most common way to help, but we also have a wide range of sponsoring opportunities.
Comments are closed.
To ensure that comments stay relevant, they are closed for old posts.
Love it! Thank you so much! :)
Such a great feature. I've always missed that! Great work!
Awesome!
Yeah! Nice work! <3
That's great! Thanks 🖤
great feature
Awesome 👏🏽
Awesome ! It was missing.
Good job 👏 ! Thanks
Awesome ❤️ 🤖
Great feature ! Thanks
That's awesome! Many thanks!
Unexpected and wonderful. Thank you!)
Perfect addition
Super, merci.
Many thanks !
My dreams came true, Thank you for this powerful feature!
Great! I've been dreaming about it
Awesome!
Thank you; this feature is osm.
amazing feature!
That's great!