PHP DegugBar has an extension to display which Twig templates were rendered.
I found a demo here but if you look at how they do it, they actually render the layout in pure PHP which kind of defeats the point of Twig, which has its own layouting system.
The problem is a catch-22: I need to render the debugbar into a Twig variable so that I can put it in the Twig layout, but if I've already rendered the debugbar it won't be able to capture the fact that I'm rendering a Twig template!
So, I'm not sure how to do this. Any ideas?
Create a custom Twig extension to render the code required to render the debug bar. This way, you can do
{{ debug_bar() }}
for instance to render the debug bar: