CodeIgniter 2.0: Everything you need to know

Posted: 2010-03-11
Category: CodeIgniter

It has been 6 months since the last CodeIgniter minor update and 18 months since the last major update. Through all this time we were given no information about the next release of CodeIgniter, but finally 2.0 is on the way.

The EllisLab team have decided to drop Subversion, use Mercurial, track their tickets on Assembla and host their code on BitBucket

So what?

The change of Version Control System to us (the general public) makes no real difference, but it wil let the team work much quicker.

The change to Mercurial would not be as interesting if it was not for the fact they were hosting the code on BitBucket, which is the Mercurial equivilent of GitHub. This is potentially the best piece of news in this entire article.

By moving to a social-coding platform like this, CodeIgniter can face the same attention from the community that jQuery and CakePHP have recently recieved. jQuery 1.4 massively benefited by being moved to GitHub, as v1.4 was made up almost entirely of community patches and suggestions.

Essentially, if you spot a bug then you can fork CodeIgniter and make the change. Then if they like it, it may well get added in. Win!

What about the code?

Well, there are a LOT of changes in the Changelog for 2.0 so far. Many of these are small tweaks, but the best?

PHP 4 support is deprecated. Features new to 2.0.0 may not be support PHP 4, and all legacy features will no longer support PHP 4 as of 2.1.0.

Well thank fuck for that. It was not a huge suprise as ExpressionEngine 2.0 had dropped support for PHP 4, but the fact it has come down to CodeIgniter is brilliant. It means slowly but surely CodeIgniter can progress forwards with great new features without having to worry about coding it in a long-winded PHP 4 compatible fashion.

Update 11/11/2010: Support for PHP4 is now no longer deprecated, but totally removed. You must now use PHP 5.1.x and change your parent::Controller()'s to parent::__construct().


Drivers are a really useful feature that Kohana has had implemented for a while, but is rather difficult to explain. I'll let EllisLab do it for me:

Drivers are a special type of Library that has a parent class and any number of potential child classes. Child classes have access to the parent class, but not their siblings. Drivers provide an elegant syntax in your controllers for libraries that benefit from or require being broken down into discrete classes.

A great example of this is the new JavaScript library. That is the main "parent" class, then the jQuery "driver" inherits and does more specific code.

Another example could be a Cache class, which then has File, Memcache, APC, etc as drivers.

Application "Packages"

This is a feature I have wanted for as long as I have been using CodeIgniter. It basically allows you to set extra directories that contain libraries, models, helpers, etc.




Using $this->load->add_package_path() you can set any full server path to use any shared location you like. No more faffing with symlinks or infecting system/libraries with your third party code.

Core libraries

Core libraries like Router, Loader, Output, etc are all system/core, but look like they can still be extended/replaced by placing yours in system/application/core.

Reserved Controller Names

The "reserved controller name" list is now tiny (if you are using PHP 5). They can be anything other than:

  • _ci_initial
  • Default
  • index

That gives you a LOT more flexibility on what you can call your controllers after the massive list in PHP 4 support.

More database config

  • swap_pre - A default table prefix that should be swapped with dbprefix. This is useful for distributed applications where you might run manually written queries, and need the prefix to still be customizable by the end user.
  • autoinit - Whether or not to automatically initialize the database.
  • stricton - TRUE/FALSE (boolean) - Whether to force "Strict Mode" connections, good for ensuring strict SQL while developing an application.

The most exciting of the lot there for me is stricton. I have had some real problems with PyroCMS on MySQL Strict Mode installations as my local environment is not strict. Using this switch you can just turn MySQL Strict Mode on and make sure it lets you know about any possible errors that would occur if you were running using Strict Mode.

Goodbye plugins!

Plugins have been removed which should really help with the "Library, Helper or Plugin?" confusion. Now your code can be boiled down much eaiser:

Helpers - One or more functions
Libraries - Lots of functions that share properties (and therefore needs to be a class)

Now the ambiguous "Plugins" have been replaced this is a much easier choice, as previously a plugin could be a function or a class. This should be the hardest upgrade step, but essentially all you need to do is find & replace "load->plugin(" with "load->helper(" and move system/application/plugins/foo_pi.php to system/application/helpers/foo_helper.php - no biggy.


By the looks of it, CodeIgniter 2.0 brings along some brilliant new changes, a heap of bug-fixes for us to be content with. Nothing massive, nothing scary and nothing incompatible. With PHP 4 support on the way out we can all dance a little jig and look forward to a much more interesting future in CodeIgniter feature development.

For now, check out the Changelog and subscribe to the RSS feed or follow the BitBucket project to keep up to date with the progress.

Edit: Michael Wales and Elliot Haughin have also written their views on the new CodeIgniter 2.0 announcement. Read their articles to get a good base of opinions on the subject.


Emmanuel Okorie


Certainly looking good... I am glad to have stuck with CodeIgniter, was itching to start working with PHP5 properly and had considered Kohana but decided against it. If EllisLab are planning to phase out php4 support, that is all the motivation I need.

Ben Edmunds


I think the thing I'm most looking forward to is no more whining in the forums about PHP 4 support...



I'm always confused with statements like that - "I would like to use CodeIgniter, but gee, it still has PHP4 support". Well, it does, but not in the sense *you* have to write v4-compatible code.



@Emmanuel Okorie: Believe it or not I was feeling the same. Yesterday I finally caved in to Jamie Rumbelow and Elliott Kembers constant Rails ear-bashing and decided to give it a try, failing that Symphony. But right as I was installed RoR, I spotted a tweet from EllisLab. It's like they knew.... :-o!

@Davebowman: I know exactly what you mean and I have argued against those idtiots for years. The PHP 4 base was mainly optional as Base4.php and Base5.php worked very differently to provide the same base in the best way for that version.

However, it did mean that certain features could not be added into the core unless there was a PHP 4 alternative, which sucked. This is a step towards getting past that.

Joel Gascoigne


Wow, this is all great news, thanks for summarising everything :)

Drivers will bring a better way to do something I've been hacking a little so far.

I'm glad PHP4 support is being dropped, that combined with using BitBucket should increase velocity. Oh, and maybe I'll get involved now :)

Benjamin Falk


@Ben Edmunds
Agreed. That's a pretty common complaint, and perhaps will encourage some who might go to other frameworks (Cake, Kohana, etc) to take a second look.



Good read, the article gave me a good view of 2.0 CI, hope CI will be open source for further more

Otar Chekurishvili


I still don't understand how JavaScript library will work in the real situations.

Some basic examples needed...

Eric Barnes


Very good write up. The first thing I noticed that may in fact be a bug is that it seems I have to extend CI_Model instead of Model.

Also with the add_application_path it would be awesome if it would support everything like modular extensions. I haven't tested this out but it seems to me if you add a bunch of extra application paths it may affect performance. But a great improvement none the less and I can see lots of awesome things these can be used for.



@Eric Barnes: I noticed this too, I wasn't sure if the problem was PyroCMS related and didn't get around to checking. The new user_guide suggests "class Blogmodel extends Model {" should still be valid syntax, so I raised an issue on BitBucket.

@Otar Chekurishvili: Me too, it's had me confused since December...

@Joel Gascoigne: BitBucket to me is the best part. If they have the time to go through people's pull requests then this will be amazingly powerful. Derek Jones suggested to me that they wouldn't have the time and that's why they wouldn't move to GitHub, so it's left me a little confused but hopeful.



Great to see new update of CI.

When will be planned to release for testing?



Just an FYI. You can see the docs on the Javascript Library online:

And the jQuery Class:



I like to see CodeIgniter going to 2.0. It's happy to see that EllisLab dropped the PHP4 backward compatibility. We will probably see a better OOP code and PDO.
I switched to Mac OS X.
Is there a Git or a Mercurial GUI for Mac OS X? And which IDE are you for developping with CodeIgniter?

Thanks for reply

Manuel Joao


Hey Phil,

Tks for the article, just one thing is missing, the release date, I know open projects can't/usually don't have strict release date, but what's your option about it, can we expect v2.0 still this year?

Do you (or any other speaker) plan in taking v2.0 to CI Bristol conference?




Hi Phil, hi everybody. EllisaLab doesn't think about introduce the concept of modules like HMVC or Matchbox? Or introduce ORM for deeply relationships between tables?

And what about PHP6 and the concept of namespaces? I know is very soon but think about, in the future CI changes totaly again? Nevermind, I think that is so far yet.

Greettings from Spain!



Hi Phil, Question, I've been with CI like 2 years not (on and off actually)but right now I want to re-start digging through the CI current release, I plan to explore it to the extend of its capabilities, do you think it is still practical for me to do that now, since sooner CI2.0 will going to be release with new features or so? Hope you can provide me some light here.

Many Thanks!



@Jorge: They plan to introduce modularity some time. It's not that they "did not think of it", they have a plan they are sticking to that involved keeping EE2 stable. They wont just throw features into CI for the sake of it.

@William: You'll be fine learning CI 1.7.2, the syntax, libraries, etc are all directly transferable as this is not a "massive change" as people keep pointing out. It could just as easily be called v1.8, I assume v2.0 was made to match the ExpressionEngine version bump.

Mahbubur Rahman


Looks like CI is reaching more standard and maturity and a good answer to some people who call CI childish :)

Nurul Ferdous


yo CI rules!

Taner Ozdas


Good decision.

I have been using Mercurial more than 2 years , for my projects. I think it is really better than svn.

I am also looking forward to see how will be the codeigniter ver 2.

Thanks for this post.

Brian Gottier


It's exciting to think about a new version of CI and the features you describe, but I guess I was hoping for more. I know you said this article just shares what you think are the best changes, and I hope we are really amazed when CI 2.0 finally comes out.

Zeeshan Rasool


Great work Phil. Hope it will be a great achievement for Codeigniter



"Well thank fuck for that." - spot on, best news I've heard re: codeigniter in a long while.



great i never use plugin anyway, and hoping using more oop function like kohana



I'm planning to switch to CI 2.0. Is it compilant with 1.x release?

Loic Sharma


I noticed that MojoMotor and Expression engine both use 2.0.. so if we want to start using 2.0, what revision should we use? Is there a stable one?

Thanks for the good info on the new features!



EE, Mojo and PyroCMS are all running on various versions of CodeIgniter 2.0 without any problems. As I have said to many people recently, in many respects CodeIgniter 2.0 is more stable than 1.7.2 as any bugs found in the 1.7.x branch have fixes put into the 2.0 branch.



I've checked the new version of CI2 and I still see the old driver for MsSQL, so it will be problem to connect to MSsql on PHP 5.3. and newer. There is no mssql driver any more. I was hopping to see new srvsql driver. What a pity.



I need to understand the best "Professional" way to install Code Igniter 2.0 & Ionize CMS 0.9.5, while having the optimal folder structure for LOCAL and LIVE development. I also need the ability to upgrade Code igniter or IONIZE easily whenever any updates are present.

Thanks for anyone's input and Help



Why are you asking me for IonizeCMS support?

Use PyroCMS, it supports local, dev and live environments out of the box and uses the very latest CI 2.0 (and always will).

Jeff Beaman


This will be a great update to an already great framework.



I would like to suggest good IDE for CodeIgniter - Codelobster PHP Edition (
It is very good PHP/HTML/CSS Editor with special plug-ins for most popular frameworks including CodeIgniter.



I couldn't find any tutorials for the new version. Any tips on where to look?



Great article, thanks!



Good post. a question ... how could I make a plugin for a CMS I'm developing. clear that in codeigniter 2.



[URL=]bcbs viagra[/URL][URL=]Viagra next day delivery[/URL][URL=]Buy cheap viagra super force north bay[/URL][URL=]prescription viagra without[/URL][URL=]Buy cheap vigora kelowna[/URL][URL=]Viagra alternative zenegra[/URL][URL=]Buy cialis super active thorold[/URL]

Posting comments after three months has been disabled.