1.  
    Am just about to start a large project and want to use a php framework (after years of using my own). Did some research last year and decided that CodeIgniter would be my best option. Did a bit more research now and Yii, http://www.yiiframework.com/, is looking interesting, especially after reading http://daniel.carrera.bz/2009/01/comparison-of-php-frameworks-part-i/. The various inbuilt security feature sound very good to me, but I assume CodeIgniter is more widely supported.

    Anybody used both of these frameworks? Any comments?
  2.  
    Codeigniter, without a doubt.

    When choosing a framework its important to factor in both the framework itself, and the documentations and community. For that reason I believe Codeigniter comes out a clear winner.
  3.  
    I agree with you on the importance of the community, but then I look at the feature list of Yii http://www.yiiframework.com/features and so many things I need are built in. Just out of interest, how easy would it be to implement some of these features using CI:

    *Integration with jQuery

    *Form input and validation including using tokens

    *Layered caching scheme, including data caching, page caching, fragment caching and dynamic content.

    *Security: Yii is equipped with many security measures to help secure Web applications to prevent cyber attacks. These measures include cross-site scripting (XSS) prevention, cross-site request forgery (CSRF) prevention, cookie tampering prevention, etc.
  4.  
    • Integration with jQuery -- well, you just use jQuery in your HTML templates? I wouldn't want the javascript tied in to the framework, though there are a number of plugins that do this.
    • Form input and validation using tokens -- not sure what you mean by tokens, but there's a pretty good validation class included with CodeIgniter.
    • Layered caching -- CI has a db cacheing library built in that's pretty neat.
    • Security -- CI has auto XSS prevention, encrypted cookies (either db driven or client side).

    I'd be surprised if Yii offered much more than CI in terms of functionality. CI is pretty robust, and we've used it for some massive projects (including two live TV voting sites) and it's taken the strain easily. Good community, easy, quick development, robust (it's been around over 3 years now).

  5.  
    thanks for the comments. Still not decided. I think tomorrow I will set up Yii and see how easy it is to put something together and how good the documentation is. Will keep you posted.

    If anybody who has actually used Yii could comment, that would be great.
  6.  
    I'd say Code Igniter as well, nice community, however if your checking out a small framework like CI you might be best checking...

    http://www.kohanaphp.com/

    Its very similar to CI and more OO
  7.  
    Okay, so on a forum you come on to ask advice, every one is advocating CI. Even if it has slightly fewer features, the fact that you are asking these questions suggests you may be back to ask for more help, so wouldn't it make sense to use the framework everyone * has a lot of experience with ?

    * The BRITs site two years running, sites for Paul MacCartney, Jenson Button, Diesel, Nike and more ...
  8.  
    I can attest to the fact that milkboy will stubbornly take the route that makes life most difficult for him ;)
  9.  
    Was going to complain about that comment Mike, but actually you are right. Have decided to listen to the masses and go with CI. At least I can then ask for help here. Thanks everybody for the advice.
  10.  
    If people want a framework (PHP) that is used by the most sites / has the most jobs, then you wouldn't use either of them, you'd use Symfony or Zend (maybe CakePHP).

    However out of these two, Yii by a mile:

    - it is far more flexible (try routing from the database in codeigniter without either creating two connections or hacking core scripts / classes).

    - It uses PHP5, so you get autoloading, cleaner code, vastly better error handling, etc rather than a framework which is stuck supporting PHP4, which even PHP have dropped support for.

    - Actively developed, where as with codeigniter you have to wait six months between versions, and that means six months between bug / security fixes.

    - Far more functionality auth, form builder, orm / crud, a proper caching library, not like codeigniter's basic effort (i.e - it supports fragment caching, memcache, apc, etc + dependencies, built in modular support, PDO supoort, etc...

    And to top it off it actually has a fully documented complete API, unilke CI.
  11.  
    bit late I'm afraid. Have gone with CI and loving it. Might look at Yii in the future.

    Thanks for playing though...
  12.  
    Errr. Codeigniter has some of the best documentation I have ever seen?
  13.  
    @milkboy, I know, but I'd thought I'd balance things up a little for anyone else reading...

    @Gecko, codeigniter has good documentation, but it doesn't have a proper API which is useful when you are more familar with it, hunting through the examples is a pain if all you want to know is a parameter, nor does it tell you what a values a function returns so you have to go through the code, hence it is lacking a full API...
  14.  

    @orwellian

    I'm pretty sure the code is commented using a standard format so you could parse it with one of those API doc generators and create a documented version of the API?

  15.  
  16.  
    @JordanHarper & stick

    Well spotted. Although that just leaves all the other (frankly more important) flaws I listed earlier with Codeigniter that led me to stop using it...
  17.  

    Well I'd say that CodeIgniter covers the majority of uses very well, but if your needs are more specific/complex it may be worth looking elsewhere. As for flexibility isn't that a subjective issue?

  18.  
    I wouldn't describe much of what I wrote as particularly specific or complex, I'd call much of it standard for many sites. Furthermore I'd suggest the popularity of the numerous user created incarnations of auth, orm, modularity, etc on the codeigniter forums show just where Codeigniter is lacking in standard functionality.

    As for flexibility being subjective, in some aspects yes, in others no, for instance there is nothing subjective about the example I gave earlier on database routing, Codeigniters outdated PHP4 obsession means it is built in such a way that routing is started before the CI "superobject" is created, hence you either end up with two connections or you have to rewrite the router class, the codeigniter.php file, controller class, etc. (Of course this is made all the worse if you are using other peoples libraries to get functionality for say modules, as you then end up having to rewrite their already rewritten router class). With every PHP5 framework all you do is extend (note extend not rewrite) one class and add the database routing functionality... flexibility...

    Codeigniter really is showing its age (or at least its bizarre decision to stick with PHP4),,,
  19.  
    @Orwellian

    I don't think you'll see many people claiming Code Igniter is the best or most full featured framework for PHP, just the one that people have the most experience with, and maybe trust the most.

    It's all well and good saying that there is better out there, but, for people who have day-to-day jobs developing for big clients, (as I can attest Jordan Harper, Andy Hawkes and myself do/did), it is very difficult to jump from framework to framework every time a new release occurs, especially given the amount of knowledge and more importantly trust that has already built up.

    There may be better frameworks, but I can knock out a solution in CI very, very quickly, and it will be efficient enough for 99% of a clients needs. If you have that same knowledge with Yii, when a better solution comes out, will you automatically jump ship?

    For me to adopt another framework, especially to recommend to clients, I would have to spend more time than just developing an example app and reading the docs - to be at all responsible as a developer you need a much more intimate knowledge.
  20.  
    Oh and CIs ability to work with PHP 4 has definitely got me out of a hole or two when a client has signed off on a hosting check-up only to reveal they have version 4 on their servers and it can't be changed, (I won't mention which particular record label this was), so it's not a majorly bizarre decision.
 
Sponsors: Web Design London