Yii(Yes it is) is a high-performance PHP framework best for developing Web 2.0 applications. As a developer i can say that Yii is a perfect choice for any sized project and using yii we can develop simple websites or extremely complex applications. You will stick with it because it is just so flexible and fun. It can reduce our development time. Yii saves you from Cross Site Scripting (XSS) attack. Yii supports extensions which has a name that uniquely identifies it among all extensions and each extensions have their own unique requirements such as importing database, upload images or validation etc.. By using extensions we can speed up our coding and also it is very easy to implement.
We know that collecting user data via HTML forms is one of the major tasks in Web application development. Besides designing forms, we need to populate the form with existing data or default values, validate user input, display appropriate error messages for invalid input, and save the input.
Yii greatly simplifies this work flow with its MVC architecture. The way Yii is set up makes it almost impossible to write duplicate code, and if you change something in your database (add or drop a table column, for instance), Yii automatically adapts. One thing that i noted is the limited functionality of active records. It is impossible to create a model based on a view for example, since a view doesn’t have a primary key. More complex SQL (such as nested queries) are very hard to implement with Active Records.
To run a Yii- powered Web application, you need a Web server that supports PHP 5.1.0. For developers who want to use Yii, understanding object-oriented programming (OOP) is very helpful, because Yii is a pure OOP framework.
What is Yii Best for?
Yii is a generic Web programming framework that can be used for developing virtually any type of Web application. Because it is light-weight and equipped with sophisticated caching mechanisms, it is especially suited to high-traffic applications, such as portals, forums, content management systems (CMS), e-commerce systems, etc.
How does Yii Compare with Other Frameworks?
Like most PHP frameworks, Yii is an MVC framework. Yii excels other PHP frameworks at being efficient, feature-rich and clearly-documented. Yii is carefully designed from the ground up to be fit for serious Web application development. It is neither a byproduct of some project nor a conglomerate of third-party work. It is the result of the authors’ rich experience with Web application development and their investigation of the most popular Web programming frameworks and applications.
Creating First Yii Application
- Download Yii. Put the ‘framework’ folder in the root directory
- Move to the ‘framework’ directory from command line using CD command in Linux
- Run the command $ php yiic webapp../htdocs
- Type yes or y when asked to do so
- Load the site to enter the new web application
- Modifications in config file can be done in the main.php file in con-fig folder of newly created web folder (here ht docs)
- For GII code generator tool use the /index.php/gii after the root folder link (here /htdocs/index.php/gii/)
Check some of its major features,
Features of Yii
- Database Access Objects (DAO), Query Builder
- Yii allows developers to model database data in terms of objects and avoid the deadliness and complexity of writing repetitive SQL statements.
- Form input and validation
- Yii makes collecting form input extremely easy and safe. It comes with a set of validates as well as numerous helper methods and widgets to simplify the task for form input and validation.
- Authentication and authorization
- Yii has built-in authentication support. It also supports authorization via hierarchical role-based access control
- Skinning and theming
- Yii implements a skinning and theming mechanism that allows you to quickly switch the outlook of a Yii-power website.
- Layered caching scheme
- Yii supports data caching, page caching, fragment caching and dynamic content. The storage medium of caching can be changed easily without touching the application code.
- Automatic code generation
- Yii provides a set of spontaneous and highly extensible code generation tools that can help you quickly generate the code you need for features such as form input, CRUD.
- Purely object-oriented
- Yii framework sticks to strict OOP paradigm. It does not define any global function or variable. And the class hierarchy that it defines allows maximum re usability and customization.
- Error handling and logging
- Errors are handled and presented more nicely, and log messages can be categorized, filtered and routed to different destinations.
- Yii is equipped with many security measures to help prevent your Web applications from attacks such as SQL injection, cookie tampering etc.
Disadvantages of Yii
Yii is written in approach that does not support the most innovative, modern advantages brought to PHP development world with release of PHP 5.3 and soon PHP version 6. The well designed platform with excellent documentation helped me to develop functionality in very short time.