Jan 18

symfony-logo.gifThanks to a great mentor (Greg) in my starting days of web development and a strong background in Computer Science from several excellent professors in college, I had a good start at web development a few years back. My original skills for PHP featured an Object oriented approach, secure validation & error reporting, some nice Pear DB functionality (with MYSQL), and the Smarty Templating Engine. My skills and knowledge regarding PHP have continued to grow each day (especially regarding efficiency and security).

Recently though, I began playing with the big new talk of the town: Ruby on Rails. I have to admit, the process hasn’t been as easy as I thought. Most of the slowdown revolves around the fact that I don’t know Ruby all that well. Combining a totally new realm of development (the Rails framework) with a new language makes the switchover difficult for me. Regardless of the difficulties, I certainly see the power of Rails and understand how it’s framework can make the development process amazingly more agile and efficient.

With that being said, at Consumer Testing Labs we’ve been talking extensively of doing some major changes to how we code. We thought it would be a great idea to implement a standard templating system (like Smarty) for everyone to use, develop some internal libraries that all the developers could agree on and use frequently, and even strong rules on everything from coding practices to directory structures to design patterns. I think we all sorta hit a no duh moment when considering how to implement all these ideas effectively: a PHP MVC framework!

The discussions at work piqued my interests enough to send me on a quest of nightly rituals over the last week or two discovering, testing, and playing around with the nearly fifty frameworks that currently exist for PHP. Ok, I didn’t try them all out, but I did try out the best of the best according to my reading (and the ones that seemed to fit into the MVC layout). After tinkering around with CakePHP, Zend Framework, and Symfony, I did a lot more reading on these types of agile development packages.

Here are my conclusions on things at this point in time (01-17-2007):

CakePHP: Had a great basic install and easy to implement first run of things. I really liked being told what to do from the Cake code itself. Sorta like a wizard. Getting into more advanced coding had me pulling my hair out though. Mostly, the documentation was at fault – but not that it was all lacking. I just thought it was sorta scattered and hard to follow. Some tutorials I found helped a bit, but I was still left confused much of the time.

Zend Framework: Where do I begin? I had an icky feeling from the get-go with this thing. First, I’ve been a little off put by Zend for trying to commercialize something that has for so long been open-source… at least for the most part (PHP). In my opinion, the problem with the Zend Framework is that it appears to be a half-hearted attempt at a framework. It seems like it’s more like a collection of libraries than a true framework. When I compare it to Cake and Symfony or even Ruby on Rails, it just doesn’t feel quite right. There are lot’s of specific reasons I feel this way, but anyone’s attempt to convince me otherwise would simply be futile, heh. I don’t think Zend would ever be the type of framework I would want to use on a daily basis (at least until they make some major revisions or enhance it a bit more).

Symfony: If you hadn’t guessed it yet, Symfony was the winner in my book. I saw a lot of true similarities here between it and my reference: Ruby on Rails. Now, don’t get me wrong; it isn’t a straight-up clone of Rails, but the good parts are all there. So what does this mean to me? It means I get to use all the power of the Rails framework (albeit a tad different) without having to learn an entire new language (Ruby). It’s the best of both worlds!

So, if you are out there looking for a well-rounded and properly executed PHP web framework, be sure to check out Symfony.

UPDATE: I have actually changed my mind! Please read this, this, and this.

49 Responses to “The Best PHP Framework: Is Symfony Really It?”

  1. Anonymous Says:

    Only wusses need a framework. Seriously.

  2. Anonymous Says:

    Call me a wuss then. It will be a God-send for companies that have problems with code diversity amongst programmers.
    I think it's also nice to stop re-inventing the wheel everytime I start a new project. I guess that's just me though.
    - Dustin Weber

  3. Anonymous Says:

    I completely agree with your comment in regards to the “wuss” name-caller.
    I found your site by looking for similarities between RoR and symfony. I know php, and now symfony.. and all i've been hearing about is RoR, and just watched some videos. I don't think i'll be jumping on the RoR bandwagon, since I think i can make some great use of my symfony knowledge.
    Take Care,
    Joe F

  4. Anonymous Says:

    Hmm, a Symfony expert.. perhaps you can persuade me to choose Symfony over CakePHP (you might understand better after reading this article I wrote on CakePHP).
    I had a lot of headaches after really delving into Symfony. Have you had a good time using it?
    - Dustin Weber

  5. Anonymous Says:

    This article seems to have written by someone without any knowledge of high level programming paradigms and design patterns. The writer uses MVC as if it in itself is a framework: “half-hearted attempt at a MVC”, “a collection of libraries than a true MVC”
    MVC is not a noun to be used with the indefinite article (a, an). It is a design pattern that have been around long before php came along. There are many interpretation of MVC and Zend has interpreted in their own way.
    The writer is encouraged to read Design Patterns by the gang of four.

  6. Dustin Weber Says:

    Well, to be honest, I was just using ’slang’ and shortening MVC framework to just MVC. I guess that threw you off, so I fixed it.
    I agree DP is a good read.
    Thanks for the feedback.
    - Dustin Weber

  7. Joep Moritz Says:

    Zend makes great use of the OO features of PHP5 in their implementation of MVC. You can extend it and add plugins at many different places. Looking at the documentation Zend looks more like a glue framework than a full stack one (see http://www.littlehart.net/atthekeyboard/2007/05/30/glue-vs-full-stack/ for a nice blog about the differences), but it does implement all those things that Symfony does (as far as I could see in 20 quick minutes).

  8. chris neglia Says:

    In evaluating frameworks, look at code documentation, performance, simplicity, security over ease-of-use necessarily. If possible, find one with high level functionality such as users/groups support. One can assume that most DB driven web apps need users (accounts), without which it’s not really a web service or it’s a info-drop site. So evaluate how easy is it to build say, users, from the blocks a framework gives you. Also, consider that DB-driven sites have some combination of 1. users, 2. tags (item- keywords, categories, a taxonomy of some sort), 3. search, 4. items/content/articles, 5. groups, 6. permissions, 7.messaging, 8. transactions. How easy is it to implement that stuff with this new and improved framework?

    All frameworks provide utility functions like dates, url parsing, pathing, breadcrumbs, etc, and everyone and their mom thinks their way is the best. These things don’t really help you because you might as well make your own framework so you understand it best. Frameworks at present are a grab bag of these utility functions. Certainly, there are few ways to do these things best, and it’s called the briefest, most secure, simplest, fastest code. Once that is established, Frameworks need to work towards higher level abstractions such as users, groups, messaging, etc.

    They also need to include a good suite for providing test-driven development and QA. This is something I’d be very interested in seeing.

  9. Aaryn Says:

    “Only wusses need a framework. Seriously.”

    OMG, does someone out there really think there is any level of “toughness” in building web applications? And if it’s for “wusses”, why the hell are you looking for articles on it in the first place?

    The best response to that is “Only an idiot never looks at ways to embrace new technology to increase productivity”. If you run a business, you are doomed. If you don’t run a business, this is probably the reason why.

    Stick with hand coding muscle-man, I’m gonna give Cake a shot and see what effect it has on output on my next project. I’ll use the extra profit to extend my gym membership to make up for my “wussiness”.

    Thankyou for taking the time to compare them Dustin. Not many people try multiple frameworks for more than a few days, it’s hard to find decent comparisons.

  10. SE Says:

    I use Zend Framework a lot lately and I am very happy with it.
    I find it to be quite a good framework and I use it specifically for routing requests and organizing my code flow. I’ll admit that the earlier versions left much to be desired, but with the new release I am very happy. I still do not use their template engine since I find smarty much easier to use and more powerful. I also like the idea that the entire application is object oriented using php 5. This makes the coding standards easier for me to manage when I have more than one person working on a project. I would like to see something that can generate a lot of the code for the zend framework based on m database schema if anyone knows of something that could do that.

    As far as symphony is concerned: I do not know much about it. so i would be interesed in hearing from people that have used both zend framework and symphony to make a point by point comparison.

  11. Djilali Tabbouche Says:

    chris neglia: totally agree here.
    I was looking for the exact features you listed and gave a try to Django
    I’m not keen on RoR mainly for configuration/tuning complexity when you want to insure performance (scalability) and ease on maintenance.
    Django is quite young but gave me some headache during testing phase.
    And PHP (without any framework) lacks the proper environment to provide RAD and flexibility.
    I will give a try to Symphony but want to know what development platform are you using.
    Thx

  12. Emil Ivanov Says:

    I’ve been using Zend Framework for some time and I’m quite happy with it. It’s a glue framework, not a full-stack making it easily expandable. Their view currently lacks some features (layouts for example), but v1.1.0 will support them. Also the ORM idea of Row/Table Data Gateway doesn’t work very good, but, because it’s a glue framework you can just grab Doctrine, stick it to your /library folder and… hey.. you got an Active Record support.
    Regards.

  13. jmark Says:

    Akelos appears to be promising and a good Ruby on Rails clone
    http://akelos.org

  14. ferisoft Says:

    You can try Codeigniter – > http://codeigniter.com
    Its good lightweight framework. I am now migrating from it to symfony but i am sure i will continue using it as its one of the fastest php frameworks and is ideal for small jobs like blogs, little shops etc. It provides great documentation and ideal classes for everything. Really it deserves a look. However symfony on the other hand provides a lot of generators which really is what a framework should be targeted at – reduce coding time. Its true its large framework with lots of pear stuff but i am sure it has future and now with propel 1.3 it will get better and better.
    But for those who want an easy approach to MVC codeigniter is for you ;)

  15. Baz L Says:

    Cake is lovely, I don’t know how to put it any simpler.
    I’ve tried the others and they just took too long to get running.

    To the “read man” that doesn’t use Frameworks…..enjoy…that’s as nice as I can put it.

  16. lee wood Says:

    I have made a website to compare all kinds of PHP Frameworks.it is http://www.phpframeworks.com/,you can sent your point of view.and to view vote for your familiar php frameworks.

  17. Hippie Pink Says:

    I found the best php5 framework to be PHP on Trax. It has all the easy of Ruby on Rails, without the ruby and far better than Cake, Symphony, Akelos, or Zend. Check it out http://www.phpontrax.com

  18. rvdavid Says:

    Thanks for the write up, I’m actually waking up from 2005 where everyone was making frameworks :) – myself included.

    I have made the decision to shift all projects to a prebuilt framework due to the way the framework landscape looks like at this point in time. Everything’s a little more mature and stable.

    I might be leaning toward zend, but after reading so many good things about symfony, I’m thinking I might give that a try first.

    Thanks again.

  19. tom Says:

    I started to use Django (a python framework) a few months ago and I am very impressed by its ease of use and power.

    Concerning the PHP framework, of course Zend, Symfony and CakePHP are the most popular but don’t forget CodeIgniter and Prado

    A good start to compare web framework activity, notoriety and maturity and get some links to tutorials and web resources :

    http://www.therightsoft.com/softwaretechnologies/webframeworks/?languageid=4

  20. EenOog Says:

    Guys it is all about time to me having to learn a new language coming from vb vbscript side of programmimg i think using a ramke work is cool also from ther you have more time to move on to the important things. keep up the good work well done and thnx a million

  21. louis Says:

    thanks dustin for writing this (do you still read comments from old posts? :-) and thanks to the posters for your suggestions.

    i’m a ruby and ror guy who finds the latter a bit much sometimes (too much magic, so i’ll probably move to merb some day soon), but recently i learned php and wanted to find something that takes advantage of oo in php5. your article and everyone’s comments (ok, except one) were very helpful in my foray into php.

  22. อะไหล่แอร์ Says:

    i love cakephp and symfony so much.

    but in my country don’t know this framework to much.

  23. Zend Framework vs. Symfony vs. CakePHP Says:

    [...] read more | digg story [...]

  24. giulia » Blog Archive » Zend Framework vs. Symfony vs. CakePHP Says:

    [...] read more | digg story [...]

  25. tuxg Says:

    Hi,
    Now that six months have passed, can you relook at Cake and Symphony and suggest us which one is better as of today?

    Thanks a lot.

  26. Zend will win it « Working from NW10 Says:

    [...] looking around I found this blog post. This guy ended up choosing Cake but in this post he recommends using Zend and I agree. For a start [...]

  27. Fahim Ilyas Says:

    I think Symfony is good, properly documented and supports agile development. Symfony really solves all the problems you can have when you start from the scratch. Having said that, you may not need a framework if your project is small in scale and the requirements are freezed (not often the case). People who are against the use of a framework can experiment by starting from the scartch. We must all pray for them :P

  28. Johny Says:

    I think the advantage of Zend is that it is more flexible so easier to use for existing projects while i would use symfony for projects which u have to build from scratch

  29. Johny Says:

    I think the advantage of Zend is that it is more flexible so easier to use for existing projects while i would use symfony for projects which u have to build from scratch

  30. aityahia Says:

    what do you think about Prado ?, i have never use a Framework and i am looking for a best one.

  31. Dustin Weber Says:

    EVERYONE

    This post is very old at this point. CakePHP has changed immensely since I wrote this article and things have gotten much much better. I would recommend you learn version 1.2 (it is in RC2) and you’ll get to learn the best php framework by far.

    Thanks,

    Dustin Weber

  32. Raj Anand Says:

    Zend V/S Symfony is a good debate. Kwiqq a social networking agency based in Brighton, UK. working with clients like Oxford University Press, Thomsons Holiday, Hansard society etc have decided to not use Symfony for future client projects: http://blog.kwiqq.com/2008/08/12/announcement-bye-bye-symfony-hello-zend/

  33. muneefvc Says:

    where is code igniter ???????

  34. anonymous Says:

    > where is code igniter ???????

    pffffft CI sucks. Don’t be a pussy – use the Zend Framework!

    Zend gives you the freedom to develop your own solution around a robust library. They provide you with default usage, but it’s up to you to develop extra functionality.

    I’ve got a couple of ideas regarding what I want to do with ZF and I had been juggling around with what Zend can do and what Symfony can do – I was put off by symfony’s bloated model layer. I’m going to read Raj Anand’s link ready to give him a hi five if his post agrees with what I’m thinking.

  35. Jon Says:

    If you like simple and wizard style framwork, try this one, http://www.amhulio.com, its in widgets style~ quite interesting

  36. Tôi học Framework - Phân nửa sự thật… Says:

    [...] http://www.dustinweber.com/cakephp/the-best-php-framework-is-symfony-really-it/ Published in PHP Tags: CodeIgniter, framework, PHP [...]

  37. ajmacaro Says:

    ive read your article back in 2007. and i was so disappointed
    that you dont like cakePHP due to lack of documentation and
    such. But i am pretty sure, youll come back and you’ll realize
    what is the best framework out there. it is cakePHP.

    And now, did you realize that even without documentation,
    it was very easy to find solution. Google groups, #cakephp in
    ircnode, and blogs, and more… and yes, cakePHP is so alive
    you can see activities here. https://trac.cakephp.org/timeline

    -AJ MACARO

  38. Shawc Says:

    Yii framework is a full-fledged framework that is written in strict OOP and provides a richer feature set than most of the frameworks referred above. And an additional advantage with Yii is that it has much lower overhead than its peers.

  39. bibo Says:

    So a web framework has to be performant but as many of you knows, 85% of time spent by your users waiting for a webpage is spent outside the framework process. See http://www.stevesouders.com/blog/.

    As a result, what i want from a framework is no bottlenecks but an efficient, elegant, coherent and understandable API. So that my worl is more productive.

    See http://jelix.org

  40. apache2 Says:

    Before trying any framework, use some time to test it’s performance, to be not disappointed at 50% of your project.
    I was VERY disappointed by cakephp’s 1.2.x performante, test it by yourself, compare with performance your own “pure code” and you will understand.

  41. Tom Says:

    You’re nuts, CakePHP is more like Ruby on Rails…and it’s more mature, has more code coverage, and a bigger community. Take a second look now, the documentation has changed. CakePHP 1.2 is very well on it’s way (stable) and there’s a nice book.cakephp.org site too now. Yes, a year or two ago the focus was on driving CakePHP’s development and not so much documentation…I have to agree. However now…You’d be insane not to get on board with Cake.

  42. mk Says:

    Hi, first of all thanks for the articles and reviews! Then, your first link in PS is broken (: Thanks!

  43. Nick Says:

    If by “wusses” you mean “efficient people who have more important things to do than reinvent the wheel” than you’re right. Thanks for the article. I’ll give symfony a shot.

  44. Indian DTH Says:

    Zend is better than other MV, if u want to create big Application.

  45. Utkarsh Sengar Says:

    What about The CodeIgniter Framework??? you missed that I guess…

  46. loto Says:

    Code Igniter easy to use but lack some general libraries. For example you have to write your authentication system from scratch with CI. May be Kohana can be right choice.. There are lots of modules that do validation,orm, authentication but it can be confusing some time. I personally choose Django

  47. Jim Says:

    “I’ll use the extra profit to extend my gym membership to make up for my “wussiness”

    - ur gay!

  48. The Best PHP Framework: Is Symfony Really It? | The Weber Report Says:

    [...] the original: The Best PHP Framework: Is Symfony Really It? | The Weber Report Share and [...]

  49. hariharan Says:

    I tried cakephp and it sucks in terms of developing web 2.0 applications especially when establishing through associations like Ruby on rails. Also the way it produces query pattern sucks like anything. Requesting your view of PHP on Trax. Is it alternative for RoR developers??? I will give a try symfony for your sake. But what about perfomance issues when compared with cake and CI?? is symfony benchmarks in terms of perfomance???

Leave a Reply