Read the latest web development and design tips at Fred Wu's new blog! :-)
Poke me on GitHub

Posts Tagged ‘Frameworks’

Choosing a PHP Framework Round 2: Yii vs Kohana vs CodeIgniter

It was over a year ago that I wrote the article that compares CodeIgniter and Kohana. Since then both CodeIgniter and Kohana have seen major progress with the release of CodeIgniter 1.7.0 and Kohana 2.3.

In December 2008, a new PHP framework called Yii has been released to the public with a stable 1.0. There were a lot of new PHP framework released in 2008, but Yii was one of the more recognised ones because:

Before I start this round of comparison, let me briefly list my experience with these frameworks, so you may interpret this article with your own judgement.

CodeIgniter: I started using CodeIgniter since its version 1.2.x from a few years ago. During the past few years I have worked on projects mainly using version 1.5.x and 1.6.x. I have now stopped using CodeIgniter in favour of using other PHP 5 only frameworks.

Kohana: I first started using Kohana when it was called BlueFlame back when it was first forked out of CodeIgniter. Since then I have lurked and participated in the Kohana community. All of my recent projects are done in Kohana.

Yii: The 1.0 release of Yii had my attention, but I didn’t really dive into it until about now. However, most of my impressions on Yii are based on its documentation and this article by Daniel.

Let’s see how they compare with each other.

Same notes as before: Grading scale: Limited < Fair < Good < Excellent. If a feature is not available in the distributed package, but is available via 3rd party libraries, I will state that in the comparison. If a feature is available both in the distributed package and via 3rd party libraries, only the official one will get assessed.

(more…)

Related posts

CodeIgniter – Loading Models and Database in One Hit

Most models I create need to access the database. You can easily have CI automatically load the database class by setting a 3rd parameter to true when loading your model:

$this->load->model('your_model', '', true);

The 2nd parameter, which in this case was left blank, is used if you want to assign a different object name to the model – something that I have never used.

Has anyone ever actually used a different object name? The reason I ask is because it’s so easy to forget about the 2nd parameter, and sometimes I try to put the true parameter to auto-load the database in the 2nd slot like this:

$this->load->model('my_model', true); // WRONG!

Of course, the easiest solution is to autoload the database through the config, but that can be a little inefficient for apps that don’t use the DB on every page.

Related posts