Master Symfony2 fundamentals

Be trained by SensioLabs experts (2 to 6 day sessions -- French or English).

Discover the SensioLabs Support

Access to the SensioLabs Competency Center for an exclusive and tailor-made support on Symfony

Fabien Potencier
New in Symfony 2.4: A Stopwatch Tag for Twig
by Fabien Potencier – August 29, 2013 – 12 comments

Contributed by
Wouter De Jong and Fabien Potencier
in #8719.

Ever wanted to time parts of a template? The new Symfony 2.4 stopwatch tag allows you to time any part of a template. This information is then stored in the profiler and available in the "timeline" section of the web profiler:

{% stopwatch "foo" %}
    ... some things that gets timed
{% endstopwatch %}

You can also use the same name more than once in your project to group the times on the same line in the web profiler timeline.

The tag being part of the Twig bridge, you can also leverage it in your Silex applications.

Comments RSS

  • Luis Mas Serral
    #1 Luis Mas Serral said on the 2013/08/29 at 11:00
    Really great feature Fabien!! :D
  • Stéphane Escandell
    #2 Stéphane Escandell said on the 2013/08/29 at 13:30
    Nice one!

    Symfony2.4 will come with so nice new features. Can't wait to it...
  • Łukasz Winiarski
    #3 Łukasz Winiarski said on the 2013/08/29 at 14:55
    any support for php template?
  • Jorge Luis Betancourt
    #4 Jorge Luis Betancourt said on the 2013/08/29 at 15:19
  • Saud Faisal
    #5 Saud Faisal said on the 2013/08/29 at 16:43
    Awesome stuff. I have worked with a ton of frameworks and Symfony is my favorite.
  • Wouter De Jong
    #6 Wouter De Jong said on the 2013/08/29 at 18:21
    Łukasz Winiarski, not yet. But I like the idea, will look at it the coming days.
  • D.Z.
    #7 D.Z. said on the 2013/08/29 at 23:11
    This is an awesome feature!
  • Sylvain Mauduit
    #8 Sylvain Mauduit said on the 2013/08/29 at 23:13
    Nice one! Thanks a lot ;-)
  • Muhammadali Shaduli
    #9 Muhammadali Shaduli said on the 2013/08/30 at 07:16
    Awesome. Can't wait to see this feature
  • Luis Cordova
    #10 Luis Cordova said on the 2013/08/30 at 18:13
    Lukas for phptemplate you just use the stopwatch component

    should be even easier
  • Luciano Mammino
    #11 Luciano Mammino said on the 2013/09/08 at 13:09
    Great feature!
  • Sergio de Candelario
    #12 Sergio de Candelario said on the 2013/09/14 at 01:54
    Thanks for this improvement, i'm really comfortable with symfony and this is a very nice new :)