Home » , » Wait is Over – Finally Yii 2.0.6 Released

Wait is Over – Finally Yii 2.0.6 Released

jaki watson | 22:19 | 0 comments
Hire Yii Web Developer
Yii team was pleased to declare the release of Yii Framework version 2.0.6. One can go through to the instructions at http://www.yiiframework.com/download/ to install or upgrade to this version. However, the version 2.0.6 is a patch release of Yii 2.0 that contains more than 70 minor features and bug fixes and various improvements to documents and wonderful progress on guide translations.

The company is thankful to the wonderful Yii community, who helped them with pull requests and important discussions. By watching Yii 2.0 GitHub Project, you can follow the development progress of Yii 2. Moreover, you can also follow Yii Twitter feeds or join Facebook group to connect with other Yii developers.

Here, you can find some of the top and exclusive features of the release:

Better Migrations Syntax –

Initially, the company were planning schema builder for 2.1, but pana1990 and vaseninm took action and now the company got much better migrations syntax:

$this->createTable('example_table', [
'id' => $this->primaryKey(),
'name' => $this->string(64)->notNull(),
'type' => $this->integer()->notNull()->defaultValue(10),
'description' => $this->text(),
'rule_name' => $this->string(64),
'data' => $this->text(),
'created_at' => $this->datetime()->notNull(),
'updated_at' => $this->datetime(),
]);

For writing database agnostic migrations, the new Migration syntax is extremely useful. However, the traditional syntax surely works.

Handling Error –

A lot of fixes and improvements are there in this release that must make error reporting and displaying errors even more reliable and useful:
  • Now Yii is able to properly handle HHVM fatal errors.
  • There is a warning written to logs in case FileCache fails to write into a file.
  • yii\web\ErrorAction displays 404 errors instead of blank page on direct access.
  • Json::encode() and Json::decode() are handling errors better throwing significant exceptions.
  • ErrorHandler::logException() now logs the whole exception object instead of only its string representation. This can be used in custom log targets to provide more detailed error information.
Complete Control Over ActiveForm Using JavaScript –

Using JavaScript, there is more control over ActiveForm. Users can update error messages of particular fields:

// add error
$('#contact-form').yiiActiveForm('updateAttribute', 'contactform-subject', ["I have an error..."]);
// remove error
$('#contact-form').yiiActiveForm('updateAttribute', 'contactform-subject', '');
Or update the whole form and, optionally, summary at once:
$('#contact-form').yiiActiveForm('updateMessages', {
'contactform-subject': ['Really?'],
'contactform-email': ['I don\'t like it!']
}, true);

Yii Message Command Improvements –

Message removal command is supporting .pot file creation. Now, it is also OK with nested Yii::t() calls like the following:
Yii::t('app', 'There are new {messages} for you!', [
'messages' => Html::a(Yii::t('app', 'messages'), ['user/notifications']),
]);

Always, it is known sorting developed messages, even if there is no new one at the time of saving to PHP files. It enables people to have much smaller diff. However, there is new config option that known as markUnused, enabling configuring behavior of adding @@ to unused messages.

Extra Session Fields –

You can now easily store extra data in session storage. Currently it's supported in yii\web\DbSession but could be possibly extended to more storages in future. In order to configure it, modify the session component in your application config:

return [
// ...
'components' => [
'session' => [
'class' => 'yii\web\DbSession',
'readCallback' => function ($fields) {
return [
'expireDate' => Yii::$app->formatter->asDate($fields['expire']),
];
},
'writeCallback' => function ($session) {
return [
'user_id' => Yii::$app->user->id,
'ip' => $_SERVER['REMOTE_ADDR'],
'is_trusted' => $session->get('is_trusted', false),
];
}
],
],
];

So, these are the new features of Yii framework 2.0.6 released that users can get once they download this new and impressive framework. However, one can also hire a professional Yii framework developer to get solution for any of their queries of the project.
Share this article :

0 comments:

Post a Comment

 
Design by: