Skip to content

Commit

Permalink
Add Twig extensions to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
barryvdh committed Aug 9, 2014
1 parent ccf9aba commit 76ca17a
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,25 @@ You can enable or disable the debugbar during run time.
\Debugbar::disable();

NB. Once enabled, the collectors are added (and could produce extra overhead), so if you want to use the debugbar in production, disable in the config and only enable when needed.


## Twig Integration

Laravel Debugbar comes with two Twig Extensions. These are tested with [rcrowe/TwigBridge](https://github.com/rcrowe/TwigBridge) 0.6.x

Add the following extensions to you config/extensions.php

'Barryvdh\Debugbar\Twig\Extension\Debug',
'Barryvdh\Debugbar\Twig\Extension\Stopwatch',

The Debug extension will replace the [dump function](http://twig.sensiolabs.org/doc/functions/dump.html) to output variables to the Messages,
instead of showing it directly in the template. It dumps the arguments, or when empty; all context variables.

{{ dump() }}
{{ dump(user, categories) }}

The Stopwatch extension adds a [stopwatch tag](http://symfony.com/blog/new-in-symfony-2-4-a-stopwatch-tag-for-twig) similar to the one in Symfony/Silex Twigbridge.

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

0 comments on commit 76ca17a

Please sign in to comment.