We are very pleased to announce the release of version 2.0.1 of the PHP framework Yii. Read more about how to install this version or upgrade to it at http://www.yiiframework.com/download/ .
Version 2.0.1 is a patch release of branch 2.0, containing about 90 minor improvements and fixes. The full list of changes can be read on GitHub . In addition to improvements to the code itself, significant documentation work has been done. Especially the full Yii 2.0 guide translated into many languages. Thanks to everyone who gave us some of their precious time improving Yii.
You can follow the development of the framework by putting an asterisk or clicking watch on the project page on GitHub . Also possiblesubscribe to Twitter and join the group on Facebook .
Next, the most important changes will be considered.
Force Resource Conversion
Through asset bundle, you can convert resources automatically. For example, LESS in CSS. However, keeping track of all changes in the source files is quite expensive. Especially when you import one resource into another. In such cases, you can forcefully convert resources. For this, the component is
assetManagerconfigured as follows:
[ 'components' => [ 'assetManager' => [ 'converter' => [ 'forceConvert' => true, ] ] ] ];
The query builder supports subqueries in many places. Now and in
$subQuery = (new Query)->select('COUNT(*)')->from('user'); $query = (new Query)->select(['id', 'count' => $subQuery])->from('post'); // $query represents the following SQL: // SELECT `id`, (SELECT COUNT(*) FROM `user`) AS `count` FROM `post`
Prevent CSS reloading with AJAX requests
YiiAssetas shown below:
Clearing the database schema cache
We added a new command to clear the database schema cache. It will be useful for laying out code on production servers. The command runs as follows:
Html::cssFile()now supports an option
noscriptdesigned to wrap the generated tag
linkin a tag
noscript. This option can also be used during configuration
AssetBundle::cssOptions. For example:
use yii\helpers\Html; echo Html::cssFile('/css/jquery.fileupload-noscript.css', ['noscript' => true]);
StringHelper::truncate()supported trimming a simple string to a given number of characters or words. HTML is now also supported, which remains fully valid when cropping.
The class has
Inflectoracquired a new method
sentence()that collects an array of words into a sentence. For instance:
use yii\helpers\Inflector; $words = ['Spain', 'France']; echo Inflector::sentence($words); // output: Spain and France $words = ['Spain', 'France', 'Italy']; echo Inflector::sentence($words); // output: Spain, France and Italy $words = ['Spain', 'France', 'Italy']; echo Inflector::sentence($words, ' & '); // output: Spain, France & Italy
Bootstrap Extension Enhancements
Bootstrap CSS framework updated to version 3.3.x. If you want to use the old version, you can specify it explicitly in the
New properties have been added to Bootstrap widgets, described in detail in the API documentation .
MongoDB Support Enhancements
findAndModifynow supported both as
yii\mongodb\ActiveQuery. For example:
User::find()->where(['status' => 'new'])->modify(['status' => 'processing']);
Requests to MongoDB are now displayed on the debug panel. To use it, you should configure the debugger as follows:
[ 'class' => 'yii\debug\Module', 'panels' => [ 'mongodb' => [ 'class' => 'yii\mongodb\debug\MongoDbPanel', ] ], ]
Redis Extension Enhancements
The Redis extension now supports UNIX sockets, which is often 50% faster than TCP. The connection is configured as follows:
[ 'class' => 'yii\redis\Connection', 'unixSocket' => '/var/run/redis/redis.sock', ]