Yii 2.0.12 is released

Jun 5, 2017

We are very pleased to announce the release of Yii Framework version 2.0.12. Please refer to the instructions at http://www.yiiframework.com/download/ to install or upgrade to this version.

Version 2.0.12 is a minor release of Yii 2.0 which contains more than 100 enhancements and bug fixes.

There are minor changes that may affect your existing applications so make sure to check the UPGRADE.md file.

Thank you, Yii community for supporting the project. We did it together!

You may follow the development progress of Yii 2 by starring or watching Yii 2.0 GitHub Project. You may also follow Yii Twitter feeds or join Yii Facebook group to connect with other Yii developers. There is also a forum thread about this news announcement.

This release took a bit longer than expected as we are busy with some other things currently. For example we are working on getting a new website setup and in less than two weeks, a Yii conference will be held in Moscow.

Since there's Yii 2.1 in development, make sure you have ~2.0.12 in your composer.json instead of >= or * so when next major version of Yii is released, your project won't break by itself.

Below we summarise some of most important features/fixes included in this release. A complete list of changes can be found in the CHANGELOG.


Test coverage is very important to detect stability issues early. Thanks to @vladis84, @boboldehampsink, @Kolyunya and other community members Yii got code covered by more unit tests.

Additionally, @schmunk42 set up an additional docker-based testing environment at GitLab. Some tests are failing there. Mainly because of differences in i18n data. This will be fixed later.


Database support got a few enhancements regarding using expressions. Now you can use them in \yii\db\QueryTrait::limit(), \yii\db\QueryTrait::offset(), and \yii\data\Sort.


MSSQL support was enhanced. First, schema reading performance was increased significantly. Second, yii\db\mssql\QueryBuilder::resetSequence() was implemented.


  • yii\base\Security::hkdf() was improved to take advantage of native hash_hkdf() implementation in PHP >= 7.1.2.
  • mt_rand() is now used instead of rand() in yii\captcha\CaptchaAction.


Migrations template was changed to use safeUp() and safeDown(). In case changing schema in transactions is not supported, such as in case with MySQL, it silently executes migration methods without transaction.

Various framework components got more same defaults:

  • \yii\data\SqlDataProvider now provides automatic fallback for the case when totalCount is not specified.
  • Data provider now automatically sets an ID so there is no need to set it manually in case multiple data providers are used with pagination.
  • yii\grid\DataColumn filter is automatically generated as dropdown list in case of format set to boolean.

yii cache command now warns about the fact that it's not able to flush APC cache from console.

yii\filters\AccessRule now allows passing parameters to the role checking function.


  • Added support for caching of yii\web\UrlRule::createUrl() results in yii\web\UrlManager for rules with defaults.
  • Added option to disable query logging and profiling in DB command
  • yii\data\ActiveDataProvider no longer queries models if models count is zero.


StringHelper got URL-safe base64 encode()/decode() methods. Should be useful for various tokens.

yii\helpers\Html::img() now allows you to specify srcset:

echo Html::img('/base-url', [
    'srcset' => [
        '100w' => '/example-100w',
        '500w' => '/example-500w',
        '1500w' => '/example-1500w',

It's now possible to render current yii\widgets\LinkPager page disabled by setting disableCurrentPageButton to true.

Access control and validators got better by requiring less dependencies:

  • yii\filters\AccessControl now can be used without user component.
  • Core validators no longer require Yii::$app to be set.