Better Twig Support
Blackfire displays the real names of Twig templates instead of their cache file paths.
Even if Blackfire works for any PHP applications, we also try to make it easier to work with popular PHP libraries.
Twig being a widely used template engine in the PHP world, we looked at how to improve its support in Blackfire. To make rendering templates as fast as possible, Twig compiles templates into PHP files; at runtime, PHP executes the PHP cached file and never reads the original template again. That’s great from a performance perspective, but makes debugging with Blackfire slightly more difficult as template files refer to the cryptic cache file path instead of the original template path:
Blackfire now automatically converts those cache paths back to the real template name to make it easier to spot which templates were rendered during code execution:
As you can see on the screenshot, Blackfire does more than just displaying the template name you used in your code, it also tells you which block or macro was called.
To benefit from this improvement, don’t forget to upgrade your PHP probe.
Happy Twig profiling!