Skip to content


Yii Framework Version 1.1

A significant upgrade to the Yii framework—1.1—came out in January, just over a year after the original 1.0 release. I’ve already updated my series on Learning the Yii Framework to make sure it’s technically accurate, but I thought I’d highlight a few of changes in Yii 1.1 here.

One significant change, which I’ll have to address in a separate post, is support for unit-based testing. The concept of unit testing has become more and more popular over the past few years, and has slowly been making its way into PHP development. The premise is simple: as you develop an application, you write a series of tests that evaluate bits of code. With unit testing, you really want to test isolated, atomic parts of an application. One of the many benefits of unit testing is that as your application grows and becomes more complicated, you can quickly apply the established unit tests to insure that the core components are still working as they should. Yii now auto-generates some testing code for you. Again, I’ll try to write up how you’d use unit testing at a later point.

A second change, that’s perhaps more evident, is the creation of an official library of Yii extensions. These are all filed under the Zii heading (i.e., in the framework/zii directory). To start, there’s a group of jQuery User Interface (jui) extensions, plus several for creating data grids and lists. A couple of standard Yii components, like Menu and Portlet, have been moved to Zii, and I like having the breadcrumbs extension in there. I’ll try to write about that separately as well.

Third, Yii now has a form builder. Much like PEAR’s HTML_QuickForm2, Yii’s form builder makes it easier to create and validate forms without lots of redundant code. I think the Yii manual has a fairly good explanation of this, but I’ll write it up separately if people feel there’s the need.

There are also a number of behind-the-scenes changes, especially as to how related Models are fetched using the Active Record Model. In terms of existing code, Yii 1.1 dropped the safeAttributes() method from Models. This is smart, because I for one never fully understood when something should or should not be marked as a safe attribute. Now safe attributes are those that are validated by other Model rules.

Finally, if you’re already using Yii for some projects, here’s what the Yii managers say about using Yii 1.1: If you are already using Yii 1.0 to develop your project which is about half-way done, we suggest you do not upgrade to 1.1 because there are quite some changes that break backward compatibility. If you just started a new project, we recommend you upgrade to 1.1 because it will receive most of our maintenance effort from now on. While we will continue to maintain 1.0, we expect it will only receive bug fixes in future. If you are new to Yii, you should start with 1.1.

Posted in MySQL, PHP, Web Development.

Tagged with .


8 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  1. Daniel Shanahan says

    Thank you, Larry, for keeping up with the yii posts. I would like to cast my vote for a separate post on the form builder.

    • Larry says

      Thanks, Daniel. I’ll put the form builder post on my to-do list!

  2. Tom says

    Larry, would you please consider writing a tutorial about how to use Yii’s RBAC feature?

    I’ve read the documentation in the definitive guide and the API, as well as several forum threads about it, but I’m still having trouble getting my head around it.

    Thanks in advance!

    Tom

  3. Adam Cooper says

    Wow this is the first time I have heard of Yii. Interesting.

    • Larry says

      If you’re looking for a PHP framework, it’s definitely worth considering. I like it quite a bit, but it has only been around for about a year and a half.

If you need quick assistance with a question or problem related to one of my books, please use the support forums instead.

Some HTML is OK

or, reply to this post via trackback.