Part of the EllisLab Network

News

CodeIgniter 2.0 - Now with more Awesome

A few days ago a new repository popped up on our internal Mercurial server. We’re not particularly creative with our naming, so it was simply CodeIgniterNoPhp4.

Goodbye PHP 4:

When we first moved our code to Bitbucket a few months ago we deprecated PHP 4 support for CI 2.0. It has been sitting in that state for quite some time. In fact, it’s stable enough to support our commercial products. With only a handful of significant changes to its codebase, the release was pushed along. We want to make CI 2 worth its name, so starting today, we’re requiring PHP 5.1.6 on our master branch.

What You Need To Know:

     
  • All core class names are prefixed with “CI_”. Be careful what you extend.
  •  
  • All core classes now use the __construct convention. Update your constructor calls!
  •  
  • CI_Base has been removed, the super object now starts at CI_Controller.
  •  
  • The compat file and compatibility helper have been removed. PHP 5.1.6 supports all the functions they provided.

The Model objects are cleaner:

Models are no longer assigned super object class members, instead CI_Model provides a __get() method that will look them up as they’re needed. This means that you can now serialize your model objects directly. It should not affect existing code.

Email and Validation chaining:

Like the DB library, the Email and Form Validation libraries have been made chainable. So the email example in the documentation can be written as:

$this->email->from('your@example.com''Your Name')
            ->
to('someone@example.com')
            ->
cc('another@another-example.com')
            ->
bcc('them@their-example.com')
            ->
subject('Email Test')
            ->
message('Testing the email class.')
            ->
send(); 

More is on the way:

We are making changes slowly and deliberately, so expect some flux in the repository for the coming weeks. It’s an exciting time for CI, and a great opportunity to provide your feedback.

Happy Coding!

Join the Discussion on the EE Forums!

Posted by Pascal Kriete on November 11, 2010