CodeIgniter 1.7.0 – A Step in the Right Direction

It’s been quite some time since CodeIgniter has seen a major update, and this week we’ve finally got one! I actually got the news via twitter, which shows just how much of a mainstream communication platform it’s becoming!

CodeIgniter 1.7.0 has plenty of new features and bug fixes, but I’m not going to list them all. You can check out the changelog to see them all.

But I would like to point out some of the more interesting updates.

First of all, there’s a new form validation class (finally!) as long as a year ago I’ve been wanting to see a fresh validation class, and this one is much much better.
It’s far less complicated, take, for example, setting validation rules.

$this->form_validation->set_rules('username', 'Username', 'required');

One line of code sets the post name, the display name, and the rules for the field. Much better than having to declare them individually.

Form validations rules can also be saved in config files, removing them from the controller code, and making them much more flexible. They are auto-loaded too.

This, is one of the best improvements CodeIgniter has seen for a long time, and I’m looking forward to getting my hands dirty and really pushing the limits of this one.

The session class has also had a little modification:

Updated the Sessions class so that any custom data being saved gets stored to a database rather than the session cookie (assuming you are using a database to store session data), permitting much more data to be saved.

So when you’re using code like:

$this->session->set_userdata($my_basket);

The ‘custom’ data is saved in the database, which means you can use more than the standard 4KB which cookies allow. Lovely.

Another nice little addition is the PHP Style Guide, which gives developers a nice set of coding standards which PHP adheres to. So, now you know exactly how to write you code so it feels right at home with CI’s native code.

I’m really happy with this update, and I’m looking forward to using it more.
What’s your favourite new/updated/fixed feature?