a Sensio Labs Product

The flexible, fast, and secure
template engine for PHP

Questions & Feedback

License

Creative Commons License Twig documentation is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License.

The Debug ExtensionΒΆ

Caution

The debug extension (Twig_Extensions_Extension_Debug) coming from the Twig-extensions package is deprecated as of Twig 1.5. Use the Twig built-in dump function from the Twig_Extension_Debug extension instead.

The debug extension provides a debug tag that can be used to output the content of the current context:

1
{% debug %}

This is really useful when a template does not work as expected. You can also output a specific variable or an expression:

1
2
3
{% debug items %}

{% debug post.body %}

Caution

The debug tag only works when the debug environment option is set to true.

This website is powered by PHP and Twig. The Twig logo is © 2010-2012 Sensio Labs