Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ZF2 - How to enable Twig's Debug / Dump function

Does anyone one know where to enable Twig's dump function in ZF2?

I've looked all over Google and I can't find anything that really relates to this issue. I would have though the ZFC-Twig module would have it right in their config but it doesn't appear to be.

Thanks

like image 215
Lionel Morrison Avatar asked Jul 08 '14 19:07

Lionel Morrison


2 Answers

According to Twig documentation, you need to activate Twig_Extension_Debug extension to have this function available.

In ZfcTwig module just add this extension to config (doc):

'zfctwig' => [
    'extensions' => [
        'Twig_Extension_Debug',
    ],
],
like image 73
lku Avatar answered Nov 15 '22 12:11

lku


If you're using Zfc-Twig, you can enable debug feature by enabling it through environment_options like this:

<?php

// enable debug
return array(
    'zfctwig' => array(
        'environment_options' => array(
            'debug'         => true
        )
    )
);
like image 38
Adam H Avatar answered Nov 15 '22 10:11

Adam H