Yii Framework For PHP Developers.

0 Comments | This entry was posted on Apr 06 2011

I had been trying many different PHP frameworks looking for one that just made sense and met my most basic requirements of MVC, PHP5 only, form pre-population and validation, ORM/Active Record and scaffolding. I eventually found Yii and have used in it several personal projects. However I had not learnt enough to be comfortable using it in some agencies I work in because of the pace the work is done. If I find that Yii doesn’t do something important then I’d be in a little trouble.

Then late last year the first Yii publication was released, titled ‘Agile Web Application Development with Yii 1.1 and PHP5’ by Jeffrey Winesett. The book is incredibly easy to follow and a pleasure to read. Each chapter made me appreciate Yii more and more for its simplicity and the rapid development that can be achieved.

After using frameworks that use scaffolding I find it a pain to use others that don’t. Nothing is more satisfying than designing your database and then using scaffolding to automatically build the model, views and controller for each database table. As of Yii version 1.1.2, scaffolding is best done using the browser based Gii interface. Gii allows you to build the model, views and controller  with a few quick steps and then you are immediately able to create, read, update and delete records from the table. It’s that easy.

Yii is very modular in every area. It provides all the functionality that you expect, but if you don’t like the way Yii does something, simply create a module to replace it to do it you own way. The book describes methods of doing that for logging, authentication and caching.

What this book also taught me was something that I have neglected up until now, Test Driven Development (TDD). Yii has tightly integrated unit testing (PHPUnit) into the framework and the book clearly states step by step instructions on how to include TDD in your project.

The book contained very few errors. I found in the last two chapters that there were misprints that were easily noticeable, probably due to not proof reading through the end of the book.

I can’t recommend this framework and the book enough. Give it a try and you won’t be disappointed.