The Symfony and Zend frameworks are so amazingly different that they almost don’t deserve to share the title “framework.”
Like the .Net Framework, Zend is a bucket of functions that, together, provide advanced interfaces to the most complex of tasks that web developers need to write regularly. They then leave the developer to work up a quick interface to the application, which they enable with their views structure. Zend’s major strength and weakness is that there isn’t one particular way to do things and that you can pick and choose which libraries you want to use.
Both frameworks are PHP5-native frameworks and won’t function in PHP4. Both are heavily object-oriented and make use of inheritance that’s only offered in PHP>5. Both use the front controller model.
The similarities end there.
Zend uses very little code generation and configuration is all in the front controller; Symfony has a great deal of code generation and a huge amount of configuration overhead. Zend is flexible about it’s directory hierarchy and allows you to heavily customize your directories to use global code libraries; Symfony has a required directory structure that is created when you use the command line tool to create modules. Zend doesn’t require command-line creation of modules.
After the jump, I’ll focus on a few areas where there’s some specific differences.
Symfony has a lot of ‘buzz’ and user support, and there are excellent guides from both the authors and the communities to get users started on the learning curve. Zend doesn’t have as much, and the documentation is really directed at more experienced developers who are old hands with the more complex aspects of object-orientation.
Symfony provides command-line tasks for unit testing and automatically generates a default (empty) testing object for you when you create a module.
Zend doesn’t have integrated support for unit testing, but all components that go into the framework require unit tests.
Zend’s templating is immature and doesn’t allow easy nesting without a well-documented hack or two, but will in the next release… or ‘Soon ™’.
Symfony’s templating is extremely mature and uses caching extensively to rapidly deliver content to users. You can plug components and entire other modules into slots in your symfony templates, and you can customize the templates as much as you want through the use of layout scripts.
Symfony has an extensive plugin and extension community in it’s community wiki. Zend, as yet, does not. It’s interesting to note that you can pull in the Zend framework’s functionality with Symfony by using the Zend Framework plugin for Symfony.
Zend uses the ActiveRecord model for databases. Symfony allows the user to plug in whatever database manager they want, including Zend_Db.
My issues with Symfony’s two current frontrunning database plugins (propel and doctrine) include the extensive bugs in both (Propel’s issues depend greatly on the lag in changing from Creole to DBO and also the stupidly complex criteron objects, and Doctrine’s as of yet an immature project that recently saw it’s first 1.0 release.) and the code generation / configuration overhead that you end up with when you’re creating hundreds of tables and managing changes to those tables. It gets to be a headache once you get past twenty or thirty tables. Zend’s active record implementation is much easier because all you need to do is direct an object at the item.
By far, Symfony is more complete, mature … but it can be overbearing when all you want to do is develop an application. It’s certainly more feature complete and allows you to be a better developer in a group. It’s the ideal framework to work with when you are working with a group of developers because everyone knows where to find everything. I love certain features like the Ajax integration, but I hate other things like the code generation and configuration overhead of (and the tendency towards serious bugs in) the Propel and Doctrine database plugins. Symfony 1.1 should be very nice and I’m eagerly awaiting it.
My personal preference though is for the Zend framework. Why? It’s more in line with the original goal of PHP — create a loose structure that’s easy for people to get into and develop in, and where you aren’t required to learn a large number of arcane commands and structures unless you set them up. The front controller setup for Zend isn’t very well explained, but it’s absurdly simple once you get into developing modules and functionality. I like the flatter file system. I like the choices I have in working with the views. I think the Zend Framework is easier to train people on and it’s easier to split roles into DBA and Coder roles due to ActiveRecord, but since you have more flexibility in how you set up your application you can’t necessarily bring in a developer that knows Zend and have them find their way around immediately.
There’s tradeoffs to each, so select which one is better for your purposes. It’s great that we’ve got such a wide selection of tools!
Where are the severe Propel and Doctrine bugs, can’t you reference them at least?
And thank you for the link to the PHP6 book, I’ll prefer “MySQS 6.0 - The complete reference”
Sebastian
Written by
Sebastian
on
November 30, 2007 at
12:57am
Well I think that this ‘I hate other things like the code generation’ statement deserves #1 on worsethanfailure.com ![]()
Written by
Hmm
on
November 30, 2007 at
3:39am
Please feel free to disagree with me but Zend framework does not limit you with Zend_Db. Zend_Db is a database abstraction layer provided in Zend Framework but you are not forced to use it. If you want you can choose to use Doctrine or any other DAL lib
Written by
pcdinh
on
November 30, 2007 at
6:35am
pcdinh - No, I definitely agree. That’s the wonderful thing about Zend vs. Symfony — with Symfony, you need to integrate the ORM logic via a plugin and code generation. With Zend, you don’t have to use a database abstraction layer at all if you don’t want to.
Written by
Karl Katzke
on
November 30, 2007 at
8:07am
ZF is an mvC framework.The models and the views are kinda useless and you end up doing everything in the controller. Of course, you can write some more code to tie things together, but then, what’s the use of having a framework in the first place? You could have done the same thing starting with just plain PHP. Don’t get me wrong, the ZF components are really nice, and they would probably go very well in conjunction with another framework, but they’re like… well, like PEAR with some controller components thrown in.
Written by
Ovidiu C.
on
November 30, 2007 at
9:21am
Well, maybe you would want to see this then: http://trac.agavi.org/browser/branches/0.11/src
Written by
Mike Seth
on
November 30, 2007 at
9:55am
Wow this has got to be the worst framework comparison i have read to date!
Forgotten headings:
Framework overhead
Code complexity
Code performance
Don’t mention that even though zend’s templating is pretty simple its also blindingly fast and still encapsulates the variables so as not to pollute the global namespace, dont include that if you use Zend_DB_Table you have to build a class per table… come on, put some effort into this
As for propel bugs, huh? where? no quoted identifier support is a known issue… what else is broken? propel 1.3 is quite stable aside from php being a buggy language of late…
I’m far from a symfony supporter but come on.
agavi.org + phptal.motion-twin.com + propel.phpdb.org if you want something lightweight and powerful and can still be fast as hell if you use your head about how you do things!
Written by
Trophaeum
on
November 30, 2007 at
10:04am
nice comparison. straight to the point and it answered most of my questions between the two frameworks. i was going to use symfony but the setup discouraged me. i tried ZF, then it worked like a charm. and the people in #zftalk (freenode) are very helpful…
Written by
wenbert
on
December 04, 2007 at
8:25pm
“Zend uses the ActiveRecord model for databases.”
Wrong. Zend uses the Table and Row Data Gateway patterns. ActiveRecord is *not* implementable in PHP until we get late static binding.
Written by
geoffrey
on
December 05, 2007 at
3:31am
“It’s more in line with the original goal of PHP”
The original goal of PHP and the right tool for the “enterprise” job aren’t necessarily the same thing.
I don’t think one is particularly better than the other. (That said, I’ve never used ZF for a “real” project, and I’m a symfony evangelist).
I think people need to realise these two tools are for two different jobs. You don’t *need* to stick to one and shun the other. If I had a need to be a helluva lot more flexible than symfony lets me be (which is *very* flexible), then I’d use tools like ZF.
My biggest gripe is that people ignore _all_ tools like this and reinvent the wheel themselves. This approach is often frought with all sorts of problems, and usually very unnecessary.
I like that I can pull in ZF bits and pieces as I need to on projects - for example, using Zend_Search_Lucene inside of my symfony app = bliss.
Viva la PHP!
Written by
Joshua May
on
December 05, 2007 at
10:29pm
I never used Zend and I used Symfony for 6+ months. Before choosing Symfony, I evaluated CakePHP and some other minor framework which might no longer exists (I forgot their names).
I choose Symfony and I do not regret it. I am currently not working on a Symfony project and I wish I was. It’s the framework that was the most flexible, even with it’s restrictions. I like the fact that it restrict the directory structure. It is true that the learning curve is higher with Symfony, but I continue to think it is worth it.
I did not have much trouble with Propel, maybe because I am not a SQL expert and was not trying to use SQL to it’s full capacity.
I would not consider Zend as “the” mvc framework for any of my personal projects, but would definitely use Zend’s components into Symfony, just like I use PEAR.
The only reason I would work on project built entirely with Zend Framework is because of the word “Zend” in it. Anyone non technical who knows what Zend is for would think it is “THE” product because it has the Zend name on it. So I would learn the Zend Framework and advertise that on my CV simply for the good reputation attached with “Zend”.
Don’t get me wrong, I know lots of people worked on Zend Framework and I am convinced it’s good code and I would recommend it just like I recommend PEAR. I am actually glad because this gives me yet another resource to get good component/package for my PHP5 projects. Not all packages has been ported to PHP5 in PEAR so Zend saves the day. ![]()
I plan on trying out Zend Framework in the near future.
Written by
Christian Roy
on
December 06, 2007 at
12:07pm
You should have a look at en alternative PHP5 framework :
http://www.jelix.org
A “REAL” framework with a small learning curve.
Written by
sylvain261
on
December 07, 2007 at
12:44am
You don’t have to use an ORM with symfony, even though v. 1.0.x comes bundled with Propel, there’s steps on the wiki that tell you how to completely remove it.
That said, even if you don’t remove it… you don’t have to use it. Simply don’t use the propel schema, don’t generate a model. Symfony will run fine in the absence of an ORM. The only things that depend on the ORM are code generators (which you hate) and Plugins.
Written by
CruxOp
on
December 17, 2007 at
5:58am
First off, I’ll get the disclaimer out of the way- I’m the project lead for Zend Framework here at Zend. Nice comparison! The characterization of ZF is accurate (well, except for the ActiveRecord part, which Geoffrey pointed out already ;)). I just wanted to mention that we’ll have many features, including advanced forms support and a ‘use-at-will’ CLI tool in 1.5 (soon to be released). You might want to revisit this comparison at that time. And if you want more ORM functionality with ZF, this project has just come to my attention: http://xyster.devweblog.org/about. It’s built on top of ZF and adds an ORM component, amoung others.
Thanks for the kind words in the conclusion!
,Wil
Written by
Wil Sinclair
on
January 22, 2008 at
12:09am
Hmm… something from me about SF and ZF.
They are both excellent. The only thing is how u look on them. If you need something rapidly, if you don’t care about application layout nor how things are working than use SF. You will end up with big project in just a second. From the other hand if you want total customized application use ZF. The only problem ( I consider this very good because a lot of “developers” use rapid frameworks and they don’t know a sh**. Tell them to write for example MVC and they will not know from where to start. ) with ZF is that you need to know A LOT about php to use it properly ( and build few things before actually start to do rapid appz. ). So if u don’t have a lot experience with php, if u don’t know what stands for OOP and MVC than go and use SF or any other framework. Don’t even think to start with ZF if you want to finish project in a blink of an eye :). It will be quite easier to catch that “concepts” but from other hand if u do it over ZF noone will know ur application layout ( if no Z_C integrated ). How someone said ZF don’t have real MVC it’s more Controller with MV light-support which makes it even easier to catch ( personally i don’t like Zend_Controller. I wrote my own based upon ZF and similar to SF ). As well I think that it’s generally bad idea to compare ZF with SF. They are completely different except php syntax :D. For those who says bad things about this 2 frameworks well people don’t be as*hol**. Build ur own framework. They all give a lot of effort to make our life easier. “Framework” like idea cannot be finished. It will always be buggy no matter how much people spend time on it. ZF got a hell of a lot bugs. Controller, well I can only say that it can be written a hell of a lot better, Layout as well. SF u can’t customize ( i hate when someone restrict something. ). Application directory can be better but who knows. I like it on that way. Someone else like it on some other way. That’s normal n get use to it :). SF vs. ZF = throw new Exception ( “non-comparable” ) ![]()
Written by
Nevio
on
April 27, 2008 at
6:03pm
Jump to comments