Kohana

Why CodeIgniter is Dead

Why CodeIgniter is Dead

Nice read on why the PHP framework known as CodeIgniter is dead.

I’ve done most of my app development in CodeIgniter (NeoInvoice, ObsceneArt, StockPyle, FB Squirrelify, Vitagen [Unreleased], Xtractor), so it is the framework I’ve been most experienced with.

It is also the framework I hate the most. Libraries are loaded as singletons and use magic:

$this->load->library('example');
$this->example->something();

What sort of IDE is going to know that load->library spawns an instance of a class, and that it is magically assigned to a property of the controller named after the library?

Kohana, a framework I switched to after realizing how bad CodeIgniter is, does it the ‘proper’ way:

$example = new Example();
$example->something();

Look, no magic, and it works with IDE’s! Heck, it’s even less code! Kohana uses the real PHP autoloading feature, instead of the hacky solution which CodeIgniter uses, a relic from its PHP4 heritage (Kohana 3.x was built from the ground up for PHP5).

CodeIgniter 2 vs Kohana 3

We’ve been doing more research into different PHP frameworks. We’ve been using CodeIgniter for a few projects recently (e.g. NeoInvoice, StockPyle, ObsceneArt 2.0 (WIP), Squirrelify, and a Martial Arts school software), but are starting to feel the limitations.

CodeIgniter makes development a breeze. There is a common method for loading external resources, connecting to databases, displaying data to the client, etc., but the common format can tend to be limiting. For example, outside libraries are handled as if they are a singleton class, and creating multiple instances can be a chore. Also, due to legacy PHP 4.0 compatibility code, autoloading of classes isn’t supported. They must be manually loaded by providing a string representation of the class.

Kohana (originally based on CodeIgniter) doesn’t have many of these restrictions. You are given a lot more freedom, but it requires more skill with PHP development. The documentation and community are not as mature as CodeIgniter either, but for the more advanced PHP developers, that isn’t a big deal as one can pour over the source code and figure everything out. Also, we like the built in module support provided by Kohana. We’ve used a third party module plugin for StockPyle and ObsceneArt 2.0, but it is a little flaky and modules tend to butt heads.

The natural transition for many PHP developers is that they look for a framework, find CodeIgniter, see it’s wonderful documentation, read about efficiency, and are hooked, and a year or so later evolve to Kohana, which has a similar architecture. Renowned Media has finally hit that point in time, and future projects will be built using Kohana.

 Scroll to top