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

Posts Tagged ‘php framework’

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

Kohana extended, transparently :)

I have started working on a project which uses both Kohana and Zend Framework. I use Kohana for low level system structure (e.g. MVC) and Zend Framework for higher level components.

What I wanted to do is to create a framework on top of these two great open source frameworks, this way building applications will be a lot easier in the future because I will have all the basic (and advanced) functionalities ready to go. :) In a nutshell, the framework will act as a ‘middle-man’ layer.

One of the goals of my framework is to act as transparent as possible. This means, the user can simply drop the framework at a convenient location, place a hook file in Kohana add it as a normal Kohana module, and that’s it! Let the magic begins!

One major achievement for me today is how I made the framework absolutely transparent. Normally this is how you extend a Kohana library or helper:

class valid extends valid_Core {}

Thanks to Kohana’s cascading file system, it will automatically start looking for ‘valid_Core’ in the modules and system directories.

Now, I wanted to add my framework, and assume my framework has an enhanced version of valid_Core, and I want to use that, what do I do? See below:

class valid extends valid_Core {}

That’s right, it is *exactly* the same syntax as before! You don’t have to alter your existing application in anyway to take advantage of more libraries and helpers. :)

And of course if the library or helper isn’t present in my framework, it will automatically fall back to the Kohana one. And if for some reason you don’t like the enhanced version, you can easily disable them. :)

That’s it for today. In the next few days I’m going to play with the new Kohana unit test library (only available in the SVN repository for now). I wonder how it compares to SimpleTest and PHPUnit.

P.S. The name of my framework is called ‘Layerful’, I will release it in open source license once it’s mature enough. :)

Related posts

Notes on Choosing a PHP Framework: A Quick Comparison of CodeIgniter and Kohana

Update: There is now a more recent comparison of CodeIgniter 1.7.1, Kohana 2.3.1 and Yii 1.0.3.

When I was reading through my subscribed feeds I came across this post: Notes on Choosing a PHP Framework: A Comparison of CakePHP and the Zend Framework by Chad Kieffer.

Chad has done a great job comparing the two frameworks that he’s interested in. That inspired me to write something up for the frameworks that I prefer and use. :)

I began hunting for PHP frameworks ever since Ruby on Rails hit the street. Coincidentally one of the first PHP frameworks I played with was CakePHP. At that time CakePHP’s documentation was nearly non-existent so I had to seek for an alternative. I did a lot of searches, and researches, and finally I was happy to see CodeIgniter. Its user guide was what impressed me the most, I am sure many of the fellow CI users would agree with me on this one. Because of the excellent documentation, I was able to start working on projects right after I spent a few hours on the user guide! Developing apps on CI was such a breeze! Today, I develop web applications in CodeIgniter, Kohana and Zend Framework. If you want to find out how to use Zend Framework components with CI or Kohana, please read my previous blog entry: Using Zend Framework with CodeIgniter.

(more…)

Related posts

Using Zend Framework with CodeIgniter

If you ever wanted to integrate CodeIgniter and Zend Framework, you might have come across this tutorial by Daniel Vecchiato.

Whilst Daniel has done a great job demonstrating the possibility of using the two frameworks together, concerns have been made: do we actually need to use hooks?

As I understand it, hooks are used to extend the core functionalities of CodeIgniter (as explained in the user guide). Obviously Zend Framework and CodeIgniter are two different systems and there is no intention for us to extend CodeIgniter’s core functionality with Zend Framework.

Using hooks can be dangerous as it’s system-wide, and it modifies the system behaviour.

What I have done is to simply use CodeIgniter’s library structure to load the Zend Framework resources. Below is the tutorial.

(more…)

Related posts