Tuesday 29 April 2014

Yii Framework 2.0 Benefits and Features

Yii Framework 2.0
Yii 2.0 Beta
Yii 2.0 Beta is a complete rewrite of Yii1.1, the current stable version. The current version of Yii framework was heavily influenced by Ruby on Rails. It is a clean adaptation of the great features of RoR to the PHP fraternity. Yii framework 2.0 is a much comprehensive web development framework, aimed to take the framework to the next orbit. The team has clearly developed Yii 2.0 keeping Yii’s philosophy of adapting the best practices and features of other web frameworks. Some of the interesting features of what Yii 2.0, compared to Yii 1.1 is discussed in the sections below.
Namespace: The foremost and very important change in Yii 2.0 is the use of Namespaces. All the core classes are now namespaced. The class names do not use the “C” prefix. The use of Namespace improves the way Yii codes are written avoiding or limiting ambiguity in class names, evading in-identifier grouping for hierarchy and naming conflicts. The Yii class loader lets the developers use any core class of Yii without explicitly including that class file.
Component and Object The component class CComponent in Yii 1.1 is now broken into two classes – Object Class and Component Class. The basic data structures are provided in Object Class, configuration and the property feature. Component Class extends from the Object class adding events and behaviors. These way developers can now use Objects for classes that represent basic data structures while component is used for application components implementing higher logic with events and behaviors.
Object Configuration is simplified, introducing a uniform way of configuring objects. Any descendant class of Object should declare its constructor.
Events definition no longer needs an on- method. The developer is free to use any event names and attach a handler to the event. The handlers can also be attached with parameters to be used at a later stage, enabling the use of global events.
Path Alias is extended to both file/directory paths and URLs. It is also closely related with Namespaces.
View Yii 2.0 introduces a View class to represent the view part of the MVC pattern. It can be configured globally through the "view" application component. It is also accessible in any view file via $this. This is one of the biggest changes compared to 1.1: $this in a view file no longer refers to the controller or widget object. It refers to the view object that is used to render the view file. To access the controller or the widget object, you have to use $this->context now.
For partial views, the View class now includes a render () function. This creates another significant change in the usage of views compared to 1.1: $this->render (...)does not output the processed content; you must echo it yourself.
For more information about the yii 2.0 beta version release, please visit: http://www.optisolbusiness.com/insight/yii-2-0-benefits-and-features

2 comments:

  1. Thanks for this post is very informative and interesting.all the points are very useful. Simple but very effective writing. Thanks for sharing such a nice post.


    Angularjs Development Company - Nintriva

    ReplyDelete
  2. Wonderful blog & good post.Its really helpful for me, awaiting for more new post. Keep Blogging!
    Outsource Yii Application Development in India

    ReplyDelete