tags:

views:

1370

answers:

20

There are quite a few PHP frameworks out there, from CodeIgniter to Zend to CakePHP to symfony.. which do you think is the best? I'd prefer answers that say why, rather than just which. Which features make your preferred framework stand out as the best?

A: 

When I do MVC-style development, I just use my own brand of framework coupled with Smarty. I find it easily the best template engine for PHP, and it makes for a very clean MVC framework.

Alex

Alex Fort
+2  A: 

Frameworks like Cake are sometimes far too bloated for an application. The feature set is overkill for a small app, and they're entirely too inefficient for an app that gets a lot of traffic.

I prefer to write my own. MVC is not a complicated design pattern; it's pretty easy to write your own and add features as you need them. That way, there's no "magic" going on behind the scenes you don't know about.

Lucas Oman
A: 

Zend Framework

Brian G
A: 

I personally haven't used it for a live app, but heard good things about Symfony.

Gaurav
+3  A: 

I like Symfony for the following reasons

  1. Great documentation. The Symfony team not only documents well with both user and API docs, but provide tons of great examples throughout.
  2. Big community. The symfony forums and plugin community are thriving
  3. Strong roadmap. They made great advances with 1.1 (sfForms, better routing, looser coupling) and 1.2 only looks to bring more great things
  4. Proven. Several big sites run on Symfony include Yahoo! Answers and TED.
  5. Not just a development framework. Includes a robust task system for deployment and other maintenance tasks.
  6. Stable. The entire framework is fully unit tested.
  7. Debugging. Symfony provides some of the best in-framework debugging I've ever seen. With only a few tweaks to a couple configuration files, you can enable the full debug toolbar which gives information about memory use, execution time, database queries, cached content, and logging of all sorts of events such as the controller actions and environment variables. Being able to visually see which portions of your page are cached and the details about that caching is pretty awesome. To the best of my knowledge, ZF, CakePHP, and CodeIgniter have nothing like this.

I could probably go on and on, but I'll stop there for now =)

Peter Bailey
A: 

I prefer CodeIgniter myself, additionally the following may be of use: PHP MVC Frameworks and PHP Zone

Teifion
+2  A: 

I've played around with Cake, Symfony, and the Zend Framework, and ZF appealed to me the most. Easy to implement, and the fact that it's backed by Zend at least provides me the illusion of safety I need to stick with it without worrying it's going to disappear any time soon. ;-) It has its drawbacks, though -- like most frameworks, it's starting to suffer from "let's make it do everything" instead of "let's keep it simple and let people build their own solutions on top of it." But, to each their own...

Novaktually
+5  A: 

Symfony is definitely my favourite.

It almost gives you everything RoR has without learning a new language or trying to figure out how to keep your deployment stable and repeatable. The Javascript integrations are very good and there seems to be quite an active community around it re: plugins and patches for when you want or need to go off the rails. The API also stays very stable with continued support for older (now 1.0) releases, but with a very nicely documented upgrade path for when you have a week available.

On the other hand, database migrations are a bit hit-and-miss; hopefully this will change soon.

Marius Marais
+3  A: 

if you want a very simple and some what of a light weight MVC, with distinct code separating, plenty of documentation, (including video tutorials -- these great to start you off) and slue of built in function and foundation code to make for fast application development, i suggest Code Igniter.

as well, it has a wonderful forum with a big community for any help and discussions about implementation and mvc architecture, etc.

if you really want to know if you'll like Code Igniter just watch one of the video tutorials

dezwald
+2  A: 
Gustavo Carreno
Doctrine indeed, it's far better than CakePHP's ORM implementation
Bart van Heukelom
+2  A: 

I evaluate technology in two ways:

How fast does it take me to say "Hello World"?

How fast can I iterate through a refactor?

It's really hard for me to recommend a PHP framework. I am about to deploy a project using symfony. This project is about a month late because the documentation was not accurate, and my blog ended up being an authoritative source for certain types of functionality. I looked at Code Igniter and although it lacks the sort of ORM, I got Hello World going in less than 5 minutes, and iterated through refactoring code pretty quickly.

The documentation is spot on.

http://codeigniter.com/

barce
+1  A: 

It depends on the scale of the project.

For basic development, I usually just code my own. For larger projects, I've tried a few different solutions:

  • If you're looking for features and support, check out the Zend Framework.The codebase is loosely coupled, so if you want to just use a few components you can. There are some disadvantages; the performance isn't great, and you're stuck with PHP 5 (I actually prefer it this way because you are forced to work with much more sophisticated object-oriented features, but given the ubiquity of PHP 4 it's worth noting).

  • CakePHP is simple, fast, and instantly familiar if you've used Rails or one the clones. It also supports PHP 4 if that's a requirement, and comes with everything in the box.

  • Symphony is good for Enterprise projects, and doesn't impose a large overhead, but it's not as impressive as the other solutions. If maturity and documentation are important requirements, and Zend is off the table, this is worth a look.
conmulligan
A: 

I've been using Code Igniter as well. There may not be nearly as much free code flying around like on Cake, so as long as you don't mind a ground-up application, CI is the way to go. CI also has a great forum (Cake didn't for a long time), and the contributors are great people.

Zend Frameworks I've only skimmed the API on (though they make a great dev IDE), but have not played around with it. Zend also offers the PHP accelerator for Apache, and the encryption library to prevent modifications (easily) to your code.

Adam
+11  A: 

This is always going to be a tricky question. To get the most out of a full-stack framework you are going to invest hours learning its idiosyncrasies. Any framework can make a quick blog example app very easily (or whatever they provide tutorials for), it's only when you use it in the real world that you find out it's wrinkles. A good framework shows its worth when it starts fighting you. How easily can you adapt to its way, or vice versa.

The list above has included two main flavours of framework:

Convention over Configuration and vice versa

CakePHP vs Zend Framework are good examples of these respectively.

My own experience has been with CakePHP and Zend, though I looked very hard at CodeIgniter before picking CakePHP initially.

Zend - Pros

  • Really well written
  • Fully Object Oriented PHP5 only (somebody please shoot PHP4)
  • Very modular
  • Has an odd mix of features, but some of the things it does like nothing else (in the PHP world): Lucene bindings, services (Flickr, Google GData etc.), Date, Captcha, JSON etc.
  • Growing all the time. Watching it since the beginning they got the design spot on and released it when the functionality was pretty sparse. They are reaping the rewards from this now.
  • Supposedly quick
  • Best of all, it plays nicely with everything else, so choosing Zend shouldn't be an either or, it should be a given!

Zend - Against

  • The documentation looks excellent at first but doesn't help much when you get into the nitty gritty
  • Getting up and running with it as a full stack MVC framework is not easy
  • Steep learning curve

CakePHP - Pros

  • Again, really well designed (though caters for PHP4 also unfortunately)
  • Very easy to get up and running - we routinely drop even static sights into CakePHP these days (using a modified "page" controller) because we know then if they client asks for a gallery, or news database or similar to be added, it's a snap to do.
  • Although it favours convention, the conventions it has picked are intuitive and excellent
  • If you step away from the conventions it doesn't fight you. The OO design is so complete you can override large swathes of functionality to do what you want
  • Lots of community information / help for this popular framework (beware though, some is misleading / dealing in older versions).
  • You never get to a point where you think there's something you want to do that you can't do in CakePHP (apart from maybe scaling / performance). The things you get for free like alternative views for XML / RSS feeds are astounding.

CakePHP - Cons

  • It's slow. Really slow. It does so much you see. You need to heavily optimize for a larger application. Use lots of caching, an opcode cache (of course) and so on. To an extent this is true for any full stack framework, but you do notice it with CakePHP.
  • The documentation looks fairly poor - it's actually improving rapidly, so I almost put this in the Pros but not quite.
  • Some of the queries it generates can be a little quirky. I suspect this is the same with any frameworks DB layer - I've just noticed it with CakePHP. This is also improving massively.

In summary we build most of our larger apps in CakePHP, but right there in the vendors folder as an svn:external we load in Zend Framework for use in lots of places. OK, the codebase before we start is a little on the meaty side, but what the hey, disk space is cheap.

I hope that helps somebody, as I really have to get back to that controller I was writing...

reefnet_alex
A: 

I don't agree fully that cakephp is slow, but by supporting php4 they have to be slower.

I really like the "convention over configuration" bit in cakephp.

ZendFramework is definitely not convention over configuration, as you have to do quite a lot of it just to get going. Zend does not have ORM so you can not say a "post has many comments", and you have to do your own sql. But zend is powerful, it is huge

But cake is simple, as far as it goes, I totally recommend it, my buddy at work really loves zend, and I can use both so no complaints here.

Trausti Thor Johannsson
A: 

Code Igniter is good but rather light-weight as others have stated. Specifically, with CI if you want to do something that is not baked in it can be a bit more work than you might expect (for example, if you need an access control system [admin, editor, user] you must either roll your own or use a thrid party supported one).

Zend Framework is great but is much more of a heavy weight contender. You really need to understand object oriented programming and MVC to use it.

gaoshan88
A: 

Code Igniter is great, but doesn't take advantage of any PHP 5 features, such as auto-class loading, better security, better performance, and better overall OOP support.

If you want the simplicity of Code Igniter that includes PHP 5 features, go with Kohana, which was originally a fork of Code Igniter that eventually became its own separate entity.

Aston
A: 

Antares Project is a cool MVC for PHP5. It's definitely still young, but promises to make a mark with php6.

Phillip Jacobs
A: 

I started using CodeIgniter couple of months ago. It's not a full-blown framework like Zend or Symphony by any means, but it provides a way of getting off the ground quickly. The best of about CodeIgniter is that there is no significant learning curve like other frameworks.

+1  A: 

I have been using Symfony for the past 18 months, and while it is everything people say, there are some things to be aware of.

  • There is a substantial per-request startup overhead. This may be fine for your pages; it might not be for REST API-like services.
  • The system is conceptually large compared to plain PHP development. It took some months to get our programmers to adopt the "Symfony way". On the other hand, programmers with Rails experience just had to learn the synonyms for what they already know.
  • The caching system is easy to get started with, but combining page or action caching with template/partial/component caching and you may well have trouble unless you are absolutely sure that Symfony knows all the inputs that may affect the output of a template/partial/component before it executes it. e.g., they must be formal parameters, not contextual.
  • Don't be wowed by the scaffolding. Any serious project probably won't end up using it.

All that said, I'd probably choose it again if I were doing another PHP project. But I prefer RoR if possible for new dev.

Robert Sanders