简体   繁体   中英

What is Twig Profiler in twig template engine and how do we use it?

Twig comes with some extensions, one of these extensions is Twig_Profiler , I tried to inject a Profiler object but it does not work:

$twig->addExtension(new Twig_Extension_Profiler(new Twig_Profiler_Profile()));

This code won't show me any profiling nor a toolbar ( What Symfony does in its Profiler ).

Any idea please?

The Twig Profiler is a visual shell for the symfony profiler in twig.

By default only requests with a bad response are logged into the profiler. When you have an exception in your code, the twig profiler toolbar will apear which you can then click to see a detailed overview of the request and the exception

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM