Reasons To Use Zend Framework

A lot of people have asked which is the best PHP framework out there. Which one suits a beginner? Which one best suits a company? How to convince a friend or boss to use Zend Framework?

In this article I present some information about Zend Framework. This is not a comparison of frameworks. When I started programming with PHP I used to roll out my own framework of sorts. As it happens to every other programmer I started exploring other's code. I started using few classes from and then from PEAR. I have been using components from Zend Framework since version 0.1. Today, at Binary Vibes we have built several applications using Zend Framework. It really has worked out well for us. We have also built a middle ware suite on top of Zend Framework which we tend to use for most of our projects. Therefore, my opinion about Zend Framework might be a bit biased. I try to be open to new ideas nevertheless.

Zend Technologies is the company that sponsors few developers to contribute to The Zend Engine, the core of PHP. The company together with the community develops the Zend Framework. Naturally, the quote, "from the makers of PHP" comes into being. One of the objectives of the Zend Framework is to promote best practices involved in application development.

Loosely coupled: The Zend Framework can be used as a component library. Meaning you can choose to use only one or a subset of components available within the framework. If you wish to use only Zend_Pdf you are free to do so without using other components of the framework. This is known as "use at will" architecture. The components are decoupled as much as possible. But there are several components that depend on other components.

MVC Components: Zend Framework also provides MVC components. MVC stands for Model View Controller architectural pattern. As we all know usage of MVC helps isolate business logic from user interface. HTTP Requests are mapped to a particular function in the user land controller class. Zend Framework also implements the front controller pattern.

Web and CLI programming: You can also use Zend Framework to write CLI scripts. Zend_Console_GetOpt component provides argument parsing functionality.

Documentation: Zend Framework's documentation is exhaustive. There are more than 500 pages of documentation in 6 languages. Apart from the reference guide, API documentation is also provided online and for download.

Support: As you would expect from an open source project several channels of support exist. Mailing list is official support channel. Developers from Zend actively participate in the support mailing lists. There is also #zftalk IRC channel on Freenode. There are numerous unofficial Zend Framework forums online. Many developers post how to articles, news, tips and tricks about Zend Framework on their blogs and websites.

Zend offers commercial support and training for Zend Framework. There is also a certification service available. There are few books published about Zend Framework. Couple of them are freely available online.

Zend Value: Zend Studio and Zend Server are the IDE and platform products from Zend. They both have a community version which is free to use. Both of these products offer integration with Zend Framework.
Zend has partnered with companies like Google, Adobe, Sitepen, etc. These partnerships bring official partner company components into Zend Framework. Which one will you use - Zend_Gdata to which Google contributes or to SomeDev_Gdata contributed by other developers? Using the official components makes a lot of sense to me. Obviously, Zend has deputed an internal team to work on Zend Framework.

Vastness: At the time of writing there are 64 components in the Zend Framework. The number is growing steadily. It won't be surprising to see 100 components in the near future. This makes Zend Framework a vast library. Below is a list few notable components. Each category has many more components than listed here. I have listed only a subset to highlight the popular components.

  • MVC - Zend_Application, Zend_Controller, Zend_View, Zend_Layout, Zend_Navigation
  • l10n and i18n - Zend_Locale, Zend_Date, Zend_Translate, Zend_Currency, Zend_Measure
  • JavaScript integration/AJAX - Zend_Dojo, ZendX_JQuery
  • Web services - Zend_Service_Yahoo, Zend_Gdata, Zend_Service_Amazon
  • Others - Zend_Acl, Zend_Auth, Zend_Mail, Zend_Pdf, Zend_Form, Zend_Search_Lucene, Zend_Validate, Zend_Tool, Zend_Test

Process and policies: In order to contribute to Zend Framework you have to sign a Contributor License Agreement(CLA). The enforcement of the CLA ensures the code doesn't infringe any copyrights or patents. Every new component has to go through a predefined process. The contributor has to publish the proposal on the Zend website. As soon as the newly proposed component has initial tests and documentation the community reviews it. Zend employees also review the code thoroughly before accepting the component.

Quality: Zend Framework focuses on quality of the code. It follows industry best practices. It uses proven object oriented design patterns. Almost all the components can be easily extended.The components of Zend Framework are unit tested using PHPUnit. All components have at least 80% code coverage. There is also a continuous integration server in place. The framework also provides a testing component.

The ZendX components are contributed by the community. Zend does not include ZendX components in their commercial support programme.

Availability of developers: Since the Zend Framework is a very popular PHP5 framework, the average PHP developer who uses frameworks is likely to be familiar with Zend Framework. Some companies have standardized on Zend Framework as the web application development framework.

Install options: Installing Zend Framework is quite a snap. Just download the code to your library directory and include it in your application. Many Linux distributions offer Zend Framework as a package from their repositories. There is also an unofficial PEAR channel Many hosting providers offer Zend Framework hosting. If you are using Subversion for your project you can take advantage of the svn:externals feature and point to the Zend Framework SVN repository.

What it is not: Zend Framework is not a middle ware. It does not force a certain way of implementing features in your application. Rather it provides tools and recommends certain conventions. You as the developer is in full control of what and how to implement in your application. This is one of the reasons why there is no Zend_Model component. In the MVC design pattern, the M stands for Model. Implementation of the model in MVC depends largely on the application itself.

Zend Framework official website
Rob Allen's Book - Zend Framework In Action
Rob Allen's popular tutorial - Getting Started with Zend Framework

FOSS Project: 


It is a pity that not more of the PHP cms out there run on Zend Framework. It would make PHP a much better development experience if WordPress, Drupal and the rest all ran on Zend Framework.

Agree. Several groups are trying to write an open source CMS using the Zend Framework. There are a couple already. I and many other ZF users do not recommend the existing CMSes for variety of reasons.

Yes, I would not recommend the existing CMSes too.
The good in that is that some are seeing that PHP can become better with Zend Framework. Nothing against any other framework, all have their reason to exists, but Zend Framework is a good standard and I hope more PHP developers will be able to see it.

Yeah nice post, I really like the ZF! The reasons you wrote down are true. But there are also some "not to use" reasons like Performance, etc. ZF in my eyes is an enterprise framework for enterprise products (like Magento). What do you think about this?

Thanks for the comment.

I haven't done a framework performance benchmark comparison yet. So, I am unable to comment what value other frameworks offer in this area.

Performance is a subjective matter. There are so many factors that can cause performance issues. At the same time there are so many ways to tune your application's performance.

Ilia Alshanetsky offers some advice.

It is also worth noting that there is an official Zend Framework performance guide.

The Zend Framework can be used to build websites of varying sizes. The last time I checked Magento, they were not using ZF MVC components.

You're right with your statement that the ZF can be used for varying website sizes. I really like the ZF. My opinion in reference to the performance thing was a meant a bit ironically. ;-) Everything has advantages and disadvantages... to build a PHP application "the good old" way (like I did before using the ZF, not using all those design patterns like MVC, ViewHelpers, etc.) is more faster then building it mostly with ZF components if you are new to it. But thats the cool thing: If you just worked with the zend framework and know the components, etc. it's really an advantage to use it.

There´s a talk about performance issues in ZF in many PHP talks. When ZF started (first versions) I have seen many performance issues too, but right now it´s not that true.
It´s not the fastest framework that you can meet, I can say that (I have made many performance analysis for a company - I can not publish those because they are not mine anymore). But it´s stable, it is one of the fastest frameworks (not the fastest, but fast enough).
There are many things in an analysis like that that must be observed:
1) Zend Framework believes in choices. So there are many ways to get a good performance, but none is forced - for example: there´s no cache in the default, if you want to have a cache you must say what time of cache, where and how it should be used. So, without that issue in mind, you could not compare performance.
2) Zend Framework is one of the most complete frameworks that there is, but to give you all that it should have some general way of working with the code. No more general code (with almost none exception) is faster than a specific one.
3) No analysis if performance can be enough. I could show you that Framework "X" is the fastest using one method and another one could say that "X" is the slowest one using another method of analysis.

So, see what it has to offer, see what you may miss using it, and give it a try. That´s a rule not just for Zend Framework, it is for any Framework. I believe that any of the most famous frameworks for PHP are good choices, I do like Zend and it is my favourite - it may be yours or not, but to say it´s slow is not necessarily true.

Very well explained, André.

ZF has a lot of potential. Documentation is vast, however, ask any developer and they say they have a hard time learning it. Perhaps the people at Zend can take a page out of the approach that CodeIgniter has taken to easy adoption.

I have seen some developers struggling to learn Zend Framework. As far as I can tell, these are developers new to OOP, MVC and frameworks in general. For a beginner it takes some time to get their head around any new framework, doesnt't it?

Zend_Tool opens gates to new ways of scaffolding the application. Building a full stack framework based on Zend Framework would be a nice idea.

didn't mean lacking for the subject... meant lacking easy adoption.

I agree that anyone new to OOP and MVC will struggle, but I think the problem people have had with it that are familiar is how flexible it is. I mean, to walk into a project using it, it can sometimes a little unpredictable. Don't' get me wrong, I prefer not the nagging nature of cakephp, but at least you know exactly where everything is and will be. I guess it takes some getting use to. so far I've much enjoyed CI, but I would like to learn ZF better now that I have ZStudio7

I wonder how comparison of ZF and Symfony 2 might look like. Many developers are saying that new version of sf should smash all frameworks. Might that be true?

Wouldn't every framework developer want to say that about their framework?

I am new to zend and starting zend is really hardful for me. I just cant find fully created sample open source websites made in zend.

Mercy. Really a nice post, also the explanation are simple and useful one. Also, ZF is easy to understand and work upon and to build our own models using Zend_DB adapter, unless you understand it. Anyhow, best OOPS library components are provided by Zend ever i have seen. Lets make use of Zend components for better applications.

Nice Resources for zend framework.

Add new comment