Download the PHP package pug/yii2 without Composer
On this page you can find all versions of the php package pug/yii2. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package yii2
Yii 2 Pug (ex Jade) extension
This extension provides a view renderer for Pug templates for Yii framework 2.0 applications.
Support
Installation
The preferred way to install this extension is through composer.
Either run
or add
to the require
section of your composer.json
file.
Configure
You can also use other pug renderer like phug or tale-pug
Phug and Pug-php (the default renderer) are automatically installed
when you install the last version of pug/yii2
, for other pug renderer,
replace the renderer class and include it.
For example, for Tale-pug, use composer require talesoft/tale-pug
then replace 'Tale\\Pug\\Renderer'
with 'Tale\\Pug\\Renderer'
in the config example above.
Cache path and View path
By default, this extension uses '@runtime/pug/cache'
to store compiled
templates, and looks in '@app/views'
to find the templates to compile.
You can change this, by specifying cachePath
and/or viewPath
in the
configuration, for example:
pug/yii
provide 2 global variables: app
(Yii::$app
) and view
(view
path given to ->render()
in your controller). It imply that:
- If you set app or view shared variables, they will be erased by those system values.
- If you pass app or view locals to the
->render()
method they will have the precedence on system values.
To avoid such name conflict, you can pack into on object and store in a shared variable with a name you chose:
With this config, app and view are no longer reserved names (can be used for your own locals or shared variables), only _yii is, and so you can get app and view like this:
Or if you set the expressionLanguage
option to "php"
:
Credits
This solution merge both project rmrevin/yii2-pug (original fork that support pug-php 2) and jacmoe/yii2-tale-pug (tale-pug and tale-jade Yii2 solution) and finally bring support for pug-php 3 and phug engines.