4
votes

Seeing various threads on this topic but not finding a working answer. Have a simple Symfony2 app (2.3.5) and trying to dump variables passed into my Twig templates. I have in my app/config/config.yml:

# Twig Configuration
twig:
    debug:            %kernel.debug%
    strict_variables: %kernel.debug%

and in my app/config/config_dev.yml:

services:
    twig.extension.debug:
        class: Twig_Extensions_Extension_Debug
        tags:
           - { name: twig.extension }

But using dump() in a twig still renders an empty page. I also increased memory limit in php.ini to 512 ... still nothing

Which part of this am I missing?

4
Please try to use my answer on this question stackoverflow.com/q/14913859/4102223 - Arkemlar

4 Answers

6
votes

Try class: Twig_Extension_Debug instead. :)

1
votes

In symfony2.3, this extension is automatically enabled when twig.debug is set to true, so you should be able to use the dump function.

0
votes

Because I didn't found the answer on the web, I will share my working solution here:

# app/config.yml
twig:
    debug: %kernel.debug%

Then in a Twig template:

{% dump var %}

Tested on Symfony 2.7