Yii: “yes, it is” the perfect PHP framework for me

CakePHP logo I’ve been learning to develop web applications using the CakePHP framework for over a year now. Suffice to say, I haven’t succeeded in building a complete app with it, as much as I tried. CakePHP makes me feel like a total n00b, so much so that it’s embarrassing. Customizing and templating it is so confusing. But I’ll refrain from giving any bad review of this framework and move on to something better.

This week, I decided to dump CakePHP and went on my search for another framework that fits my expectation of the perfect PHP framework.

SMARTY logo I’ve dabbled with SMARTY before. Very interesting framework, and much easier than CakePHP. I was able to modify a web app running on SMARTY. The codes makes sense to a seasoned web developer like me. But it didn’t fit my need – it was easy to learn, but not entirely easy enough. I spent two days on the documentation and tutorial. Way too long, I think.

I needed something with a simpler learning curve, similar to how I learned to use and develop in WordPress, which took me just about 5 hours to get the whole thing. I wanted a framework that makes sense, and makes development faster.

Yii was my answer.

Yii Framework logo

After reading through its user guide, I knew Yii was perfect. Here’s why I fell in love with it:-

  1. Yii-based apps are driven by data logic. When I build an app, I always start by making sure that my database schemes are well-designed and optimised to fit the business flow of the app. Therefore, my codes are automatically generated based on my database design. And, yes…
  2. Yii can generate the whole shebang of PHP codes for you automatically! Just define which database you want to use, and with a few clicks it will create a CRUD (create-read-update-delete) app for you. It looks so cute, I tell you! Speaking of automatic…
  3. Yii can generate a skeleton app for you automatically. This skeleton app include a view page, a login page, contact page and basic navigation, all wrapped within a completely organized folder tree based on the standard MVC programming model.
  4. The extensive choice of Yii functions makes sense. As a self-taught web programmer, I was able to map out its functions to all of the RESPONSE and REQUEST tasks I most often use when building webapps within a matter of minutes. It also doesn’t hurt that the Yii community has kindly provided cheat sheets for the functions so that I can do a quick reference when I need to.
  5. The Definitive Guide to Yii document that comes with the Yii install is actually quite easy to go through, at least for me. I don’t know why, though. I thought CakePHP docs were more user-friendly and attractive, but surprisingly I was able to go through Yii documentation and tutorial in just two hours and not get cross-eyed by the end of it.
  6. Yii uses MySQL and SQLite as its choice database types. Of course, you can run any other type of databases as long as you have its PDO enabled in your php.ini file. I develop using MySQL most of the time, but my fondness for SQLite is increasing, due to the fact that SQLite is so darn lightweight and easy to use.
  7. Yii is integrated with jQuery, which means that many of the necessary validation functions I use can easily be plugged within the Yii function calls itself, which is usually only a line of code or two.
  8. Yii is open-source, and it’s free. Open-source products turn me on.

I’m using Yii right now for a website re-design. I can’t wait to show it off once it’s done.