views:

8490

answers:

10

I'm looking for a PHP framework. I did a research here and found CodeIgniter would be best for me. But then I discovered that there is Kohana based on CodeIgniter. And I'm annoyed, because since Kohana is based on CodeIgniter, it should work similar, but it is optimized for PHP 5, so it should be faster in a PHP 5 environment. I was going to choose Kohana and then I found benchmarks that points CodeIgniter as the faster one. I don't understand it. If Kohana is updated more frequently and optimized for PHP 5, shouldn't it be better then?

I'm experienced PHP programmer, but Smarty is the only framework I know, and I don't want to waste next few month for learning a bad framework.


Thanks for your reply, I will give Kohana a try.

+2  A: 

Not entirely certain, but I would suspect CodeIgniter has a larger community than Kohana. That's probably reason enough to go with CI and ignore any subtle differences in speed.

You might also want to take a peek at CakePHP if you haven't already. I think it's a little more bulky than either of those two, but more featureful.

Mark
Cake has an entirely different philosophy than CI or Kohana. I don't think that someone interested in those two would be a good fit for Cake.
rick
I know, I'm just saying. It's worth investigating all possibilities first. If he did, and decided on CI, then great.
Mark
[ I would suspect CodeIgniter has a larger community than Kohana. That's probably reason enough to go with CI and ignore any subtle differences in speed.]CodeIgniter has been heavily advertised as easy, accessible, simple, light footprint, etc. So, it has appealed to lots of developers at that entry level. Quantity, just like speed, should not be a key criterion for choosing a framework. I'd rather take advice from 1 experienced Kohana developer than 10 from CI. I know this because I've been in both communities.
mike
Fair enough. I was mostly just speculating :) I find every framework has some little quirk that bothers me.
Mark
I would much rather there be 10x more developers than a small quality advantage. To each his own.
pbreitenbach
+32  A: 

Kohana is a huge improvement over CI, but suffers from lack of exposure (for the time being). Kohana has a modular architecture and clearer class definitions than CI. Also, because Kohana is maintained by the community, development is more active.

Kohana does consume more memory than CI, but execution time is nearly the same. This article has some interesting benchmarks.

Also, see Exploring Kohana as an alternative to Codeigniter

EDIT: Kohana 3 is available. Handy HMVC.

Abi Noda
1+ Kohana over CI
Sepehr Lajevardi
That article on onwired.com is very good :) I will use Kohana then.
Thinker
thanks for the onwired link.
Thorpe Obazee
+2  A: 

I didn't use CI for very long before switching to Kohana, so I can't say much about it, but I did like Kohana a lot better. It just seems to make more sense.

Eli
+11  A: 

I've used both, and imo Kohana betters CI in all aspects except documentation. That was Kohana's objective from the start: improve CI.

The single most important reason to choose Kohana, imo, is autoloading. The CI loader is a php 4 hack. It loads and maintains singleton classes. The caller, not the loader, should determine if a class is a singleton. Furthermore, if a class is meant to be a singleton, it shouldn't expose a constructor. If you want to call a static method in CI and you use the loader, a class instance will be created - how unnecessary. Not to mention, I hate having to write: $this->load->library('myclass');

Edit: One future advantage of CI, maybe its salvation, is Expression Engine 2.0 CMS. Since EE 2 is built on CI, a CI user will be able to easily integrate and extend the CMS.

rick
+4  A: 

Kohana is optimised for PHP5, as in it takes advantage of the PHP5 features such as autoload, it is not necessarily FASTER than CI in PHP version 5.

If you are worried about the performance, at the execution speed level, just build a script that puts ALL your PHP files (classes, etc.) inside a single PHP file and use eAccelerator. The lag will be cut down by a 100...

Mario
If you're worried about performance, why are you using PHP? :)
dirtside
I'm simply suggesting a way to optimise a common flaw in PHP frameworks, which goes along the nature of the question asked by the author. Blindly suggesting to move away from PHP due to bad performance is irresponsible and lacks insight.
Mario
dirtside = troll.
jmccartie
+5  A: 

I started out with CodeIgniter and have used it for a little over a year now. Then a month or so ago I started reading about Kohana and decided to give it a try. I ported all of my code base to Kohana and started messing around with it. I have since gone back to CodeIgniter, however I did keep the Kohana branch just in case I ever want to go back.

The main reason I went back was documentation is terrible on Kohana compared to CodeIgniter.

I really didn't find a real staple reason to stay with Kohana.As for speed seemed fairly consistent between both frameworks. Neither seemed any easier to code against.

Jayrox
Kohana documentation is fine. You just have to look a little harder to find it.
Abi Noda
I agree with Abi. That was my initial reaction to Kohana's docs. As they always say, the code is the best 'documentation' ever.But with a lot of people now contributing to the docs, I think the Kohana documentation has come a long way since.
Thorpe Obazee
CodeIgniter documentation is very good which is a clear benefit. Kohana would appeal to more users with better docs. "have to look a little harder to find it" is not a feature.
pbreitenbach
"have to look a little harder to find it" is not a feature. -- agreed.
jmccartie
A: 

Kohana sounds very promising as it aspires to fix some of the shortcomings of CodeIgniter (mainly taking advantage of php5). But its evolution has been a disjointed. CodeIgniter is currently quite a bit more stable (not talking about bugs), has better docs and seems to have a more judicious designer behind it.

pbreitenbach
+14  A: 

I really don't want to be a party pooper but I don't think PHP4 / 5 support / speed or the auto loading feature being a PHP4 hack and whether or not it maintains singleton classes really is that relevant.

It seems the real pro's, who actually know what the above means and can demonstrate the differences between PHP 4 / 5 speed and pinpoint where and why in the application this effect is caused, would use more enterprise frameworks like Zend or Cake.

Speed of the app – unless you are trying to make your app slow, any php framework will deliver decent enough speed for small applications. Only if you're on a site with 10.000's of users per day will this start to matter.

I have only experience with CodeIgniter and I use to build small/midsized company websites and intranet applications because :

  • it allows me to do so quickly
  • keeps code clean via MVC
  • documentation is the best i've ever seen
  • usually things work exactly as indicated: very few bugs or quirks

All the technical nitty gritty is not really that important.

The community "model" – I'd much rather have a bunch of core-guys from Ellislab who communicate clearly and honestly and release code that works perfectly 99% of the time, than a model like Drupal's where anyone can upload a module and you discover 3 months down the line it actually doesn't work at all like it should, no support it available and you're fcked.

So concluding, I would say go with CI if you want robust documentation to help you deliver your product on time. If you're really good with PHP and like experimenting and digging in the code, then try Kohana.

Best of luck!

stef
+14  A: 

I like the Kohana syntax better than CI. To use a model in CI, you have to load it first:

$this->load->model('model', $modelname);

In Kohana, it's familiar OOP syntax:

$modelname = new Model();

Also, using helpers in Kohana is more intuitive. In CI you have to load the helpers, like above, then each of that helper's methods is usable, but I don't like that the methods become global and don't indicate a namespace of sorts.

CI:

$this->load->helper('email');
send_email($to, $subject, $msg);

Kohana:

email::send($to, $from, $subject, $msg);
wmid
+8  A: 

It's worth noting that Kohana has since been totally re-written. It started as a fork with minor tweaks but now only shares similarities to CodeIgniter, and should not be considered "an improved PHP5 version".

CodeIgniter is quick, backwards compatible, well documentation, well tested and has a massive community.

Kohana is optimized for PHP5, allows slightly cleaner code but is let down by its documentation and community.

If you are fairly new to PHP, OOP or MVC then go with CodeIgniter as it will seriously smooth the transition. If you are a MVC, OOP KING then give Kohana a try and see which you like better.

Phil Sturgeon