Introduction to Yii2 Framework

What is Yii?

Yii is a high performance, component-based PHP framework for rapidly developing modern Web applications. The name Yii (pronounced Yee or [ji:]) means “simple and evolutionary” in Chinese. It can also be thought of as an acronym for Yes It Is! – Yii PHP Framework 

What is Yii2?

Yii currently has two major versions available: 1.1 and 2.0. Version 1.1 is the old generation and is now in maintenance mode. Version 2.0 is a complete rewrite of Yii, adopting the latest technologies and protocols, including Composer, PSR, namespaces, traits, and so forth.

Hoping you read the above questions and answers let say Welcome to Yii2 Framework. Yii2 was under development for more than a year. As it is mentioned in official documentation, Yii2 is a complete rewrite of Yii1.1. That’s a big change from the developer point of view.

What are the major changes in Yii2?

PHP Version

One of the basic and most important changes in Yii2 is Yii 2.0 requires PHP 5.4.0 or above. Yii2 is built using most of latest features provided in PHP release version 5.4.0.  Make sure your server is running PHP version 5.4.0 or above before choosing Yii2.

Introduction of Namespaces

From PHP version 5.3.0, Namespaces were introduced in PHP programming. Due to the large number of libraries for PHP, the chances of name collision in different libraries became a real problem. Namespaces will help us to remove such problems. Namespaces are just like a folder which groups the files for a library.

Yii2 and Namespaces

Yii2 is built completely using namespaces. So we have to be familiar with using namespace in PHP programming inorder work with Yii2. Here is good tutorial for how to use namespaces in PHP. Once you are ready to work with namespaces you are almost good to start development in Yii2 framework.

Integration with Bootstrap

Like the close integration with jQuery in Yii 1.1, Yii 2 is having a close integration with Bootstrap HTML Framework. Infact all the widgets are modified so that we can customize the html properties of those widgets inorder to match the bootstrap structure. This will be very useful for modern web application development because most of the designs are now based on bootstrap html framework.

Yii2 Basic and Yii2 Advance

Yii2 framework is available in two templates, first one is basic and the other is advanced. Usually most of the projects will require only the basic template unless you really want to use advanced template. Advanced template provide multiple tires of application with individual application files sharing some common configuration. Basically the advanced template will help to create multiple application with sharing some common config such as db configuration. This helps us to create and application for frontend and a separate application for the backend. This is not required for most of the projects.

Structure of Yii 2 Framwork Fles

Unlike with Yii 1, standard installations of Yii 2 results in both the framework and an application skeleton being downloaded and installed. The core framework files are stored in the vendors folder.

Thats all for now. I will be writing more article on how to install amd write hello world application in Yii2 framework soon. So stay followed via Facebook, Twitter and Google

Yii Framework 2.0 Preview Rleased

Yii  development team has released the first preview of Yii Framework 2.0. The code is available at at GitHub. Development of version 2.0 has been started 2 year ago and the complete code has been rewritten.

Yii 2.0 is still under heavy development, so it is not yet able to use for production. Yii was the most popular framework on 2012.

You may keep an eye on the following Yii 2 resources: