This file contains the upgrade notes for Yii 2.0 Twig Extension. These notes highlight changes that could break your application when you upgrade extension from one version to another.
Upgrading in general is as simple as updating your dependency in your composer.json and
running composer update
. In a big application however there may be more things to consider,
which are explained in the following.
Note: The following upgrading instructions are cumulative. That is, if you want to upgrade from version A to version C and there is version B between A and C, you need to follow the instructions for both A and B.
Since 2.2.0 extension uses Twig 2. See twig upgrade notes. Also Twig 2 needs at least PHP 7.0.0
path()
and url()
syntax was changed. Wrap route with array:
{{ path('blog/view', {'alias' : post.alias}) }}
{{ url('blog/view', {'alias' : post.alias}) }}
should become
{{ path(['blog/view'], {'alias' : post.alias}) }}
{{ url(['blog/view'], {'alias' : post.alias}) }}
If you're registering globals, adjust your config:
[
'html' => '\yii\helpers\Html',
]
// should become
[
'html' => ['class' => '\yii\helpers\Html'],
]