New in Symfony 2.4: A Stopwatch Tag for Twig

Warning: This post is about an unsupported Symfony version. Some of this information may be out of date. Read the most recent Symfony Docs.

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:

1
2
3
{% 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.

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

Really great feature Fabien!! :D
Nice one!

Symfony2.4 will come with so nice new features. Can't wait to it...
any support for php template?
Awesome!!
Awesome stuff. I have worked with a ton of frameworks and Symfony is my favorite.
Łukasz Winiarski, not yet. But I like the idea, will look at it the coming days.
This is an awesome feature!
Nice one! Thanks a lot ;-)
Awesome. Can't wait to see this feature
Lukas for phptemplate you just use the stopwatch component

should be even easier
Great feature!
Thanks for this improvement, i'm really comfortable with symfony and this is a very nice new :)

Comments are closed.

To ensure that comments stay relevant, they are closed for old posts.