views:

909

answers:

7

Hi All,

I am deciding on a framework to try out for PHP and have narrowed it down to CakePHP and CodeIgniter.

I have a couple questions for any of you who have used or are familiar with both:

  1. I like the fact that Cake keeps most of the code outside the webroot by default. Especially since I may end up using a single framework install for multiple apps. I see CI will do that too, but you have to configure it and move some stuff around. Is that as secure and reliable, or is it an afterthought hack?

  2. Is either, or are both, easy to upgrade and maintain over the long term? As new versions of the framework and php itself come out, I don't want to find my stuff either breaking or becoming outdated.

Thanks!

Edit:

This is a very old post, but I thought I would update it with what I finally ended up doing, which was to use Kohana.

+1  A: 
  1. is a non-issue.

  2. CodeIgniter has a sponsor behind it, so it's definately the one to choose for the long term. Also, it's faster.

orlandu63
A: 
  1. This is a non issue. The app has a couple of lines which says where the core and your application code lies. You just need to change those lines.

  2. You can never anticipate this one.

The state of PHP is a wildcard here. One app (CI) is built to be compatible with PHP4 the other requires PHP5. If you need to deal with the possibilty of a web host only supporting older versions of PHP then you need to go with CO.

Another issue is unit testing. If you require your framework to ship with tests, then CI is not the way to go.

Personally, I feel comfortable with CI because of the corporate backing. The company behind CI is making real profit from their efforts. Though CI is free, their paid product (ExpressionEngine) will eventually live on CI. The same could be said of the Zend Framework and even the birth of Rails (originally built for Basecamp.)

+2  A: 

I have deployed multiple applications on CakePHP and it's been a very, very, nice experience. You can't go wrong either way, as both are solid.

Paolo Bergantino
+4  A: 

You should try both frameworks for a week or so, building something trivial (like a blog or wiki) in both, and see which you prefer using. Whatever makes the most sense to you will probably sustain you the longest through upgrades an deprecations.

CakePHP is in a bit of a volatile state right now, still unearthing bugs while pushing to release version 1.2 (which is not backward compatible). I wouldn't suggest building a critical application with it if you need something rock solid right now. If you can wait a month or two for things to settle, then it's probably a moot point.

To address your concerns:

1) Cake and CI do it the same way (iirc). They are equally secure, reliable, and hackish on this front.

2) Everything changes. If you need concrete, perpetual assurance of stability and backward compatibility, roll your own framework. There's not that much to it, and you're guaranteed that nothing changes unless you want it to.

drfloob
A: 

A minor correction to an above comment: both are compatible with PHP4, not just CI. Also, I don't think that having a sponsor makes CI and more or less upgradable or maintainable. Money doesn't solve those problems in the least.

I use CakePHP for a variety of applications and I've been happy with it thus far. 1.2 is a huge improvement over 1.1, and while the library source may change from RC3 to Final, I don't think any code you write will become obsolete. My only niggle is that the Manual isn't as comprehensive as it should be (in my opinion), and I end up in the API quite a bit. The trade-off there is that I now understand the code behind the scenes very well. In any case, I highly recommend it.

On the other hand, I've never played around with CI, so I can't recommend CakePHP over CI. I would take each for a spin and see which one grabs you. Whichever one you choose, study the hell out of its conventions and capabilities. When I started with Cake, I unwittingly wrote a bunch of code to do something Cake did "automagically" by having me set one variable in the controller.

A: 

CodeIgniter is very flexible as you would see once you try it. So how your application would be maintainable would fall you your hands.

I have also deployed multiple applications using the same installation. I usually create 2 applications for CMS projects (one for admin, one for the front-end).

Thorpe Obazee
A: 

To address both of your questions from a CodeIgniter perspective (I don't use Cake):

1) CodeIgniter doesn't keep itself outside the webroot by default, but it can do so with some very simple changes. The first part of my CI tutorial series explains how to do so, along with a walk through of the setup of a new CI instance. Once finished the only part of CI that needs to be in the webroot is a small index.php bootstrap file.

2) I've got an application which I originally developed in CI 1.4.x and I've sucessfully migrated to 1.5.x then 1.6.x. With each new release the CI dev's make available detailed upgrade instructions laying out what needs to be replaced so upgrades are fairly easy.

Jim.

Jim OHalloran