Twig Extension for Yii 2
This extension provides a ViewRender that would allow you to use Twig view template engine
with Yii framework 2.0.
For license information check the LICENSE-file.
Documentation is at docs/guide/README.md.
Installation ¶
[!IMPORTANT]
- The minimum required PHP version is PHP
7.4.- It works best with PHP
8.
The preferred way to install this extension is through composer:
php composer.phar require --prefer-dist yiisoft/yii2-twig
Usage ¶
To use this extension, configure it as described in documentation.
Class Reference
| Class | Description |
|---|---|
| yii\ |
Extension provides Yii-specific syntax for Twig templates. |
| yii\ |
|
| yii\ |
GetAttrAdjuster swaps Twig_Node_Expression_GetAttr nodes with yii\ |
| yii\ |
Optimizer removes echo before special functions call and injects function name as an argument for the view helper calls. |
| yii\ |
|
| yii\ |
Template helper |
| yii\ |
Empty loader used for environment initialisation |
| yii\ |
TwigViewRenderer allows you to use Twig templates in views. |
| yii\ |
Class-proxy for static classes Needed because you can't pass static class to Twig other way |
| yii\ |
|
| yii\ |
|
| yii\ |
|
| yii\ |
|
| yii\ |
|
| yii\ |
|
| yii\ |

