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 PHPClasses.org 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
* 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 pear.zfcampus.org. 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.