yiisoft / yii2-twig

Yii 2 Twig extension.
http://www.yiiframework.com
BSD 3-Clause "New" or "Revised" License
136 stars 61 forks source link

Twig_Extension_Debug extension doesn't Work #129

Closed freetibet000 closed 3 years ago

freetibet000 commented 3 years ago

Hi.

I am trying to use Twig_Extension_Debug and get error "Failed to instantiate component or class "\Twig_Extension_Debug".

Here is my config section:

'view' => [
            'class' => 'yii\web\View',
            'renderers' => [
                'twig' => [
                    'class' => 'yii\twig\ViewRenderer',
                    'cachePath' => '@runtime/Twig/cache',
                    'options' =>  [
                        'debug' => true,
                        'auto_reload' => true,
                    ],
                    'extensions' => [
                        '\Twig_Extension_Debug',
                    ],
                    'globals' => [
                        'html' => ['class' => '\yii\helpers\Html'],
                    ],
                    'uses' => ['yii\bootstrap'],
                ],
            ],
        ],

Does it mean that i need install this extension by composer? I can't find any info in docs.

Could you explain where am i wrong?

Thank you.

bizley commented 3 years ago

Does 'Twig\Extension\DebugExtension' work?

freetibet000 commented 3 years ago

I believe no, because when I adding '\Twig_Extension_Debug', into extension section I get error "Failed to instantiate component or class'

bizley commented 3 years ago

What I meant is if

'extensions' => [
    'Twig\Extension\DebugExtension',
],

works. And as I just tested it does.