Symfony Framework vs. Zend Framework

Filed Under (General) by Wenbert on 05-12-2007

Tagged Under : , ,

Here is a comprehensive comparison between the Symfony Framework and the Zend 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.

Getting Started

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.
Unit Testing

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.

Templating

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.

Plugins

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.
Database Modules

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.

For the conclusion, you should read here ;P

Getting started with: Zend Framework, symfony and CakePHP

Filed Under (General) by Wenbert on 14-10-2007

Tagged Under : , , , ,

This article was posted at IBM developerWorks a few days ago - I don’t know how I missed it. The article gets you started on three of the most popular PHP MVC Frameworks. Surprisingly, Code Igniter, which is my second option next to Zend Framework is not included in the article. Definitely as must read for anyone who is into MVC Development.

Here is a snippet:

There are several frameworks available for nearly every language. Selecting the right one for your needs can be somewhat difficult, especially if you haven’t used any of them before. While advice and opinions from colleagues and trusty developerWorks authors can be helpful in this area, there is really only one guiding principle that should be followed when selecting any framework: A framework is only as good as the amount of time and effort it saves everyone. A framework is no good if it works well for you but causes a significant increase in support calls. A framework is no good if it is easy to support, but hinders rather than assists your development. A framework is useless if it is elegant, but causes support and development issues.

When selecting a framework for your project, consider everyone involved, from the top down, and when you evaluate the framework, keep the impact to other parties in mind.

When you consider adopting a framework, look at your application closely and ask yourself it if needs a framework. A framework isn’t a necessity. Enterprise applications will continue to be written without the use of frameworks. Will a framework help you with the project? Will it save everyone time and effort? Will your application perform better on a framework? Will it provide the stability you are lacking? If the answer to any of these questions is yes, you should look to adopt a framework. If the answer to all of these questions is no, a framework will only complicate matters.

Unfortunately, size and scope restraints do not allow for a comprehensive coverage of all available PHP frameworks. This series focuses on three frameworks:

  • Zend Framework
  • symfony
  • CakePHP

These were selected based on a variety of factors, but might be best classified as “The One Your Boss Knows About,” “The One Someone Else Already Installed,” and “The One They’ve Been Talking About.” I encourage you to research CodeIgniter, Seagull, Web Application Component Toolkit (WACT), PRADO, Zoop, PHP on Trax, or any of the many other PHP frameworks available. Framework selection is very much a personal choice, much like selecting a language in which to code. This series isn’t going to tell you which framework is better, or worse, than the others. Where a framework does something well, it will be called out. Where a framework seems unwieldy, this will be called out, as well. Even if we are not comprehensive in our coverage of the myriad frameworks, the approach we take will help you weight the strengths and weaknesses of other frameworks. You need to form your own opinions about the frameworks being examined, which ones you like, and what you decide to pursue.

The Zend Framework

Everyone knows Zend — “The PHP Company.” When you download and install PHP, you’re downloading it from Zend and have been since around V3. In addition to distributing PHP, Zend Technologies has offered a wide range of PHP support technologies over the years. It should be no surprise that Zend offers a framework for PHP — a popular one at 2 million downloads to date. If your boss has heard of a PHP framework, the Zend Framework is likely to be the one.

symfony

Sponsored by Sensio, symfony “aims to speed up the creation and maintenance of Web applications, and to replace the repetitive coding tasks by power, control and pleasure.” The symfony framework has been used worldwide in a number of enterprise-level applications, perhaps most notably Askeet and Yahoo! Bookmarks. Odds are that if someone you know has installed, used, or played around with a PHP framework, that framework was symfony.

CakePHP

Borrowing heavily from Ruby on Rails, CakePHP aims to bring simplicity and scalability to PHP frameworks. Consistently recognized as a top PHP framework, CakePHP was recently selected as the core around which V5 of the Mambo Content Management System. Driven by a strong community and a rapidly growing user base, CakePHP’s popularity is growing steadily. If you’ve overheard a conversation about PHP frameworks, that conversation was probably about CakePHP.

Click here for the entire article.

Subscribe to Rss Feed : Rss