yii\base\Security we replaced Mcrypt (which has been abandoned for eight years now) with OpenSSL, for which we should say thanks to Tom Worster, who is watching Yii for security. Since OpenSSL is present by default in most PHP distributions, compatibility problems should not arise. But, if they do, be sure to inform.yii\rbac\DbManager . The entire hierarchy is cached, which greatly increases the performance of checkAccess() . RBAC caching is disabled by default. Included as follows: return [ 'components' => [ 'authManager' => [ 'class' => 'yii\rbac\DbManager', 'cache' => 'cache', // <---- ], 'cache' => [ 'class' => 'yii\caching\ApcCache', ] // ... ], ] yii\filters\PageCache to cache various types of data and headers. This is how you can cache the index action of the REST controller: public function behaviors() { return [ [ 'class' => 'yii\filters\PageCache', 'only' => ['index'], 'duration' => 60, ], ]; } yii\web\AssetManager::appendTimestamp to true. The file modification time will be added to the URL of the JS and CSS resources, so the client will always receive the latest version: return [ 'components' => [ 'assetManager' => [ 'class' => 'yii\web\AssetManager', 'appendTimestamp' => true, ], // ... ], ] yii\helpers\Url::current() , has been added, which makes it easier to change the current URL by adding or removing GET parameters: // , $_GET = ['id' => 123, 'src' => 'google'], "post/view" // /index.php?r=post/view&id=123&src=google echo Url::current(); // /index.php?r=post/view&id=123 echo Url::current(['src' => null]); // /index.php?r=post/view&id=100&src=google echo Url::current(['id' => 100]); yii\log\FileTarget , you can now turn off automatic file rotation, which is useful if additional utilities do this: return [ 'components' => [ 'log' => [ 'targets' => [ [ 'class' => 'yii\log\FileTarget', 'enableRotation' => false, ], ], ], ], ]; yii\helpers\Html the data attribute is handled in a special way: // : <div data-name="xyz" data-age="20"></div> echo Html::tag('div', '', ['data' => ['name' => 'xyz', 'age' => 20]]); ng and data-ng are also processed. This is useful primarily for those working with AngularJS. For the remaining attributes, the array will be converted to JSON.yii\helpers\Html::$dataAttributes .trim validation rule, you will find that trimming is now done on the client. You can disable this behavior by setting the enableClientValidation property of the trim validation rule to false.yii\helpers\Html::activeTextInput() or yii\widgets\ActiveField::textInput() , you may need to set the maxlength property to create input fields. If the corresponding model field has a string validation rule, maxlength can be taken from it. For this maxlength you must specify the value true: // "name" : ['name', 'string', 'max' => 128] // generates: <input type="text" ... maxlength="128"> echo Html::activeTextInput($model, 'name', ['maxlength' => true]); yii\base\Configurable interface to mark the class as “configurable”. In this case, yii\di\Container expects the constructor to accept the configuration array: class Foo implements \yii\base\Configurable { public function __construct($a, $b, $config = []) { } } $container = new \yii\di\Container; $object = $container->get('Foo', [1, 2], ['prop1' => 3]); // : $object = new Foo(1, 2, ['prop1' => 3]); yii\base\Object to achieve a similar effect.Source: https://habr.com/ru/post/251847/
All Articles