README.md 964 Bytes
Newer Older
1 2
Smarty Extension for Yii 2
==========================
3

4
This extension provides a `ViewRender` that would allow you to use Smarty view template engine.
5

6
To use this extension, simply add the following code in your application configuration:
7

8
```php
Alexander Makarov committed
9
return [
10 11 12 13 14 15 16 17 18 19 20
    //....
    'components' => [
        'view' => [
            'renderers' => [
                'tpl' => [
                    'class' => 'yii\smarty\ViewRenderer',
                    //'cachePath' => '@runtime/Smarty/cache',
                ],
            ],
        ],
    ],
Alexander Makarov committed
21
];
22 23
```

24 25 26 27 28 29 30 31
Installation
------------

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
32
php composer.phar require --prefer-dist yiisoft/yii2-smarty "*"
33 34 35 36 37 38 39 40 41
```

or add

```json
"yiisoft/yii2-smarty": "*"
```

to the require section of your composer.json.
42 43

Note that the smarty composer package is distributed using subversion so you may need to install subversion.