Chapter 1. Introducing Zend Framework – Zend Framework in Action

Chapter 1. Introducing Zend Framework

This chapter covers
  • Why you should use Zend Framework
  • What Zend Framework can do
  • The philosophy behind Zend Framework

PHP has been used to develop dynamic websites for over 10 years. Initially, all PHP websites were written as PHP code interspersed within HTML on the same page. This worked very well, as there is immediate feedback, and for simple scripts this was what was needed. PHP grew in popularity through versions 3 and 4, so it was inevitable that larger and larger applications would be written in PHP. It quickly became obvious that intermixing PHP code and HTML was not a long-term solution for large websites.

The problems are obvious in hindsight: maintainability and extensibility. While PHP intermixed with HTML allows for extremely rapid results, it is hard to continue to update the website in the longer term. One of the really cool features of publishing on the web is that it is dynamic, with content and site layouts changing. Large websites change all the time, and the look and feel of most sites is updated regularly, as the needs of the users (and advertisers!) change. Something had to be done.

Zend Framework was created to help ensure that the production of PHP-based web-sites is easier and more maintainable in the long term. It contains a rich set of reusable components including everything from a set of Model-View-Controller (MVC) application components to PDF generation classes. Over the course of this book, we will look at how to use all the Zend Framework components within the context of a real website.

In this chapter, we will discuss what Zend Framework is and why you should use it, and we’ll look at some of the design philosophies behind it. This introduction to the framework will act as a guide for the rest of the book and it will help make the design decisions behind each component clearer. Let’s start by looking at how Zend Framework can provide structure for a website’s code base.

1.1. Introducing Structure to PHP Websites

The solution to this tangled mess of PHP code and HTML on a website is structure. The most basic approach to structuring applications within PHP sites is applying the concept of “separation of concerns.” This means that the code that does the display should not be in the same file as the code that connects to the database and collects the data. The usual novice approach mixes the two types of code, as shown in figure 1.1.

Figure 1.1. The organization of a typical PHP file created by a novice interleaves HTML and PHP code in a linear fashion as the file is created.

Most developers begin to introduce structure to a website’s code by default, and the concept of reusability dawns. Generally, this means that the code that connects to the database is separated into a file called something like Having separated out the database code, it then seems logical to separate out the code that displays the common header and footer elements on every page. Functions are then introduced to help solve the problem of global variables affecting one another by ensuring that variables live only within the scope of their own function.

As the website grows, common functionality shared between multiple pages is grouped into libraries. Before you know it, the application is much easier to maintain, and adding new features without breaking existing code becomes simpler. The web-site continues to expand until it gets to the point where the supporting code is so large that you can’t hold a picture in your head of how it all works.

PHP coders are used to standing on the shoulders of giants because our language provides easy access to libraries such as the GD image library, the many database client access libraries, and even system-specific libraries such as COM on Microsoft Windows. It was inevitable that object-oriented programming, known as OOP, would enter the PHP landscape. While classes in PHP4 provided limited OOP features, PHP5 provides excellent support for all the things you’d expect in an object-oriented language. There are visibility specifiers for class members (public, private, and protected) along with interfaces, abstract classes, and support for exceptions.

PHP’s improved object-oriented support allowed for more complicated libraries (known as frameworks) to evolve, such as Zend Framework, which supports the Model-View-Controller design pattern—a way of organizing web application files. This design pattern is shown in figure 1.2.

Figure 1.2. A typical MVC application separates the code of an application into separate concerns.

An application designed using MVC principles results in more files, but each file is specialized in what it does, which makes maintenance much easier. For example, all the code that performs database queries is stored in classes known as models. The actual HTML code is known as the view (which may also contain simple PHP logic), and the controller files handle the connection of the correct models to the correct views to display the desired page.

Zend Framework isn’t the only option for organizing a website based on MVC principles; there are many others in the PHP world. Let’s look at what Zend Framework contains and why it should be considered.

1.2. Why Use Zend Framework?

Before we dive into using it, we will first look at why we use Zend Framework over all the other PHP frameworks out there. In a nutshell, Zend Framework introduces a standardized set of components that allow for easy development of web applications that can be easily developed, maintained, and enhanced.

Zend Framework has a number of key features that make it worth investigating:

  • Everything is in the box.
  • It has a modern design.
  • It is easy to learn.
  • It has full documentation.
  • Development is simple.
  • Development is rapid.

That list is rather stark, so let’s look at each item in turn and see what it means to us as website developers.

1.2.1. Everything is in the Box

Zend Framework is a comprehensive loosely coupled framework that contains everything you need to develop your application. This includes a robust MVC component to ensure that your website is structured according to best practices and other components for authentication, searching, localization, PDF creation, email, and connecting to web services, along with a few more esoteric items. These components can be grouped into the six categories shown in figure 1.3.

Figure 1.3. There are many components in Zend Framework, but we can group them into these six categories for ease of reference.

That’s not to say that Zend Framework doesn’t play nice with other libraries; it does that too. A core feature of the design of the framework is that it is easy to use just those bits you want to use with your application or with other libraries such as PEAR, the Doctrine ORM database library, or the Smarty template library. You can even use Zend Framework components with other PHP MVC frameworks, such as Symfony, CakePHP, or CodeIgniter.

1.2.2. Modern Design

Zend Framework is written in object-oriented PHP5 using modern design techniques known as design patterns. Software design patterns are recognized high-level solutions to design problems and, as such, are not specific implementations of the solutions. The actual implementation depends on the nature of the rest of the design. Zend Framework makes use of many design patterns, and its implementation has been carefully designed to allow the maximum flexibility for application developers without making them do too much work!

The framework recognizes the PHP way and doesn’t force you into using all the components, so you are free to pick and choose. This is especially important as it allows you to introduce specific components into an existing site. The key is that each component within the framework has few dependencies on other components. This allows you to introduce specific Zend Framework components, such as Zend_Search, Zend_Pdf, or Zend_Cache into your current project without having to replace all the rest of your project code.

1.2.3. Easy to Learn

If you are anything like us, learning how a vast body of code works is difficult! Fortunately, Zend Framework is modular, encouraging developers with a “use at will” design philosophy that helps make it easy to learn, one step at a time. Individual components don’t depend on lots of other components, so they are easy to study. The design of each component is such that you do not need to understand how it works in its entirety before you can use it and benefit from it. Once you have some experience in using the component, learning to use the more advanced features is straightforward, as it can be done in steps. This reduces the barrier to entry.

For example, the Zend_Config configuration component is used to provide an object-oriented interface to a configuration file. It supports two advanced features: section overloading and nested keys, but neither of these features needs to be understood in order to use the component. Once the user has a working implementation of Zend_Config in her code, confidence increases, and using the advanced features is a small step.

1.2.4. Full Documentation

No matter how good the code is, lack of documentation can kill a project through lack of adoption. As Zend Framework is aimed at developers who do not want to have to dig through all the source code to get their job done, Zend Framework puts documentation on an equal footing with the code. This means that the core team will not allow new code into the framework unless it has accompanying documentation.

Two types of documentation are supplied with the framework: API and end-user. The API documentation is created using phpDocumenter and is automatically generated using special DocBlock comments in the source code. These comments are typically found just above every class, function, and member variable declaration. One key advantage of using DocBlocks is that IDEs such as the Eclipse PDT project or Zend’s Studio are able to supply autocompletion tool tips while coding, which can improve developer productivity.


Included documentation

Zend Framework supplies a full manual that can be downloaded, and it’s also available online at The manual provides details on all components of the framework and shows what functionality is available. Examples are provided to help you get started in using the component in an application. More importantly, in the case of the more complicated components (such as Zend_Controller), the theory of operation is also covered, so that you can understand why the component works the way it does.

The documentation provided with the framework does not explain how to fit all the components together to make a complete application. As a result, a number of tutorials have sprung up on the web, created by community members to help developers get started on the framework. These have been collated on a web page on Zend Framework’s wiki at The tutorials, while a useful starting point, do not tend to go in depth with each component or show how it works within a nontrivial application, which is why this book exists.


1.2.5. Simple Development

As we have noted, one of PHP’s strengths is that developing simple, dynamic web pages is very easy. This ease of use has enabled millions of people to have fantastic websites who may not have had them otherwise. As a result, PHP programmers range in ability from beginner hobbyists through to enterprise developers. Zend Framework is designed to make development simpler and easier for developers of all levels.

So how does it make development simpler? The key feature that the framework brings to the table is tested, reliable code that does the grunt work of an application. This means that the code you write is the code you need for your application. The code that does the boring bits is taken care of for you and does not clutter up your code.

1.2.6. Rapid Development

Zend Framework makes it easy to get going on your web application or to add new functionality to a current website. The framework provides many of the underlying components of an application, so you are free to concentrate on the core parts of your application. You can get started quickly on a given piece of functionality and immediately see the results.

Another way the framework speeds up development is that the default use of most components is the most common case. In other words, you don’t have to set lots of configuration settings for each component just to get started using it. For example, the most simplistic use of the whole MVC is bootstrapped with just the following code:


Once it’s up and running, adding a new page to your application can be as easy as adding a new function to a class, along with a new view script file in the correct directory. Similarly, Zend_Session provides a multitude of options that can be set so that you can manage your session exactly as you want to; however, none need to be set in order to use the component for most use-cases.

1.2.7. Structured Code is Easy to Maintain

As we have seen, separating out different responsibilities makes for a structured application. It also means that when you are fixing bugs, it’s easier to find what you are looking for. Similarly, when you need to add a new feature to the display code, the only files you need to look at are related to the display logic. This helps to avoid bugs that might be created by breaking something else while adding the new feature. The framework also encourages you to write object-oriented code, which makes maintaining your application simpler.

We have now looked at why Zend Framework has been developed and at the key advantages it brings to developing PHP websites and applications. We’ll now turn our attention to the components Zend Framework contains and how they will help us to build websites more easily.

1.3. What is Zend Framework?

Zend Framework is a PHP glue library for building PHP web applications. The components fit together to provide a full-stack framework with all the components required to build modern, easily built, maintainable applications. That rather simple description doesn’t tell the whole story though, so we’ll look at where this framework came from and what it actually contains.

1.3.1. Where did it Come From?

Frameworks have been around for years. The very first web framework Rob used in a real project was Fusebox, which was originally written for ColdFusion. Many other frameworks have come along since then, with the next major highlight being Struts, written in Java. A number of PHP clones of Struts were written, but didn’t translate well to PHP. The biggest problem was that Java web applications run in a virtual machine that runs continuously, so the startup time of the web application is not a factor for every web request. PHP initializes each request from a clean slate, so the large initiation required for Struts clones made them relatively slow as a result.

A couple of years ago, a new framework called Rails entered the world, based on a relatively unknown language called Ruby. Rails (or Ruby on Rails as it is also known) promoted the concept of convention over configuration and has taken the web development world by storm. Shortly after Rails came along, a number of direct PHP clones appeared, along with a number of frameworks inspired by Rails, rather than direct copies.

In late 2005, Zend Technologies, a company that specializes in PHP, started Zend Framework as part of its PHP Collaboration project to advance the use of PHP. Zend Framework is an open source project that provides a web framework for PHP and is intended to become one of the standard frameworks that PHP applications of the future will be based on.

1.3.2. What’s in it?

Zend Framework is composed of many distinct components that can be grouped into six top-level categories. Because it is a complete framework, you have everything you need to build enterprise-ready web applications. However, the system is very flexible and has been designed so that you can pick and choose to use those bits of the framework that are applicable to your situation. Following on from the high-level overview shown earlier in figure 1.3, figure 1.4 lists the main components within each category of the framework.

Figure 1.4. Zend Framework contains lots of components that include everything required to build an enterprise application.

Each component of the framework contains a number of classes, including the main class for which the component is named. For example, the Zend_Config component contains the Zend_Config class along with the Zend_Config_Ini and Zend_Config_Xml classes. Each component also contains a number of other classes that are not listed in figure 1.4. We will discuss the classes as we go through the book and learn about each component.

The MVC Components

The MVC components provide a full-featured MVC system for building applications that separates out the view templates from the business logic and controller files. Zend Framework’s MVC system is made up of Zend_Controller (the controller) and Zend_View (the view) with Zend_Db and the Zend_Service classes forming the model. Figure 1.5 shows the basics of Zend Framework’s MVC system, using Zend_Db as a model.

Figure 1.5. The MVC flow in a Zend Framework application uses a front controller to process the request and delegate to a specific action controller that uses models and views to craft the response.

The Zend_Controller family of classes provides a Front Controller design pattern, which dispatches requests to controller actions (also known as commands) so that all processing is centralized. As you’d expect from a fully featured system, the controller supports plug-ins at all levels of the process and has built-in flex points to enable you to change specific parts of the behavior without having to do too much work.

The view script system is called Zend_View, which provides a PHP-based template system. This means that, unlike Smarty or PHPTAL, all the view scripts are written in PHP. Zend_View provides a helper plug-in system to allow for the creation of reusable display code. It is designed to allow for overriding for specific requirements, or even for using another template system entirely, such as Smarty. Working in conjunction with Zend_View is Zend_Layout, which provides for aggregating multiple view scripts to build the entire web page.

Zend_Db_Table implements a Table Data Gateway pattern which, along with the web services components, can be used to form the basis of the model within the MVC system. The model provides the business logic for the application, which is usually but not always database-based in a web application. Zend_Db_Table uses Zend_Db, which provides object-oriented database-independent access to a variety of different databases, such as MySQL, PostgreSQL, SQL Server, Oracle, and SQLite.

The most simplistic setup of the MVC components can be done with this code:

require_once 'Zend/Controller/Front.php';

It is more likely, however, that a more complicated bootstrap file will be required for a nontrivial application. We will explore this in Chapter 2 when we build a complete application with Zend Framework.

The MVC classes work in combination with some of the core classes that create the nucleus of a complete application. The framework itself does not require configuration, but some configuration of your application is invariably required (such as database login details). Zend_Config allows an application to read configuration data from PHP arrays or INI or XML files and includes a useful inheritance system for supporting different configuration settings on different servers, such as production, staging, and test servers.

Security is very much on the minds of every PHP developer worth his salt. Input data validation and filtering is the key to a secure application. Zend_Filter and Zend_Validate are provided to help the developer ensure that input data is safe for use in the application.

The Zend_Filter class provides a set of filters that typically remove or transform unwanted data from the input as it passes through the filter. For example, a numeric filter will remove any characters that are not numbers from the input, and an HTML entities filter will convert the “<” character to the sequence “&lt;”. Appropriate filters can be set up to ensure that the data is valid for the context in which it will be used.

Zend_Validate provides a very similar function to Zend_Filter, except that it provides a yes/no answer to the question, “Is this data what I expect?” Validation is generally used to ensure that the data is correctly formed, such as ensuring that the data entered in an email address field is actually an email address. In the case of failure, Zend_Validate also provides a message indicating why the input failed validation so that appropriate error messages can be returned to the end user.

Authentication and Access Components

Not every application needs to identify its users, but it is a surprisingly common requirement. Authentication is the process of identifying a user, usually via a token, such as a username/password pair, but it could equally be via a fingerprint. Access control is the process of deciding whether the authenticated user is allowed to have access to, and operate on, a given resource, such as a database record.

As there are two separate processes, Zend Framework provides two separate components: Zend_Acl and Zend_Auth. Zend_Auth is used to identify the user and is typically used in conjunction with Zend_Session, which can store that information across multiple page requests (known as token persistence). Zend_Acl then uses the authentication token to provide access to private information using a role-based access control (RBACL) system.

Flexibility is a key design goal within the Zend_Auth component. There are so many ways to authenticate a user that the Zend_Auth system is built with the intention that the user will provide his own method if none of the provided solutions are suitable. Authentication adapters are provided for HTTP digest, database tables, OpenID, Info-Card, and LDAP. For any other method, you must create a class that extends Zend_Auth_Adapter. Fortunately, this is not difficult, as we will see in Chapter 7.

As Zend_Acl is an implementation of an RBACL system, the manual describes this component in abstract terms. RBACL is a generic system that can provide access to anything by anyone, so specific terms are discouraged. Hence, we talk about roles requesting access to resources. A role is anything that may want to access something that is under the protection of the Zend_Acl system. Generally, for a web application, this means that a role is a user group that has been identified using Zend_Auth. A resource is anything that is to be protected. This is generally a record in a database, but could equally be an image file stored on disk. As there is such a variety of resources, the Zend_Acl system enables us to create our own very simply by implementing Zend_Acl_Role_Interface within our class.

Internationalization Components

We live in a multicultural world with multiple languages, so Zend Framework provides a rich set of functionality for localizing your applications to match your target users. This covers minor issues, like ensuring that the correct currency symbol is used throughout, to full support for changing all the text on the page to the correct language. Date and time routines are also provided with a simple, object-oriented interface, as are settings for the many ways that a calendar can be displayed.

Zend Framework provides the Zend_Locale class, which is responsible, along with Zend_Currency and Zend_Measure, for ensuring that the correct language and idioms are used. The Zend_Translate component is concerned with the actual translation of a website’s text into the desired language.

Interapplication Communication Components

Zend Framework provides a component to read data from other websites. Zend_Http_Client makes it easy to collect data from other websites and services and then present it on your site. This component works much like the curl PHP extension, but it is implemented in PHP and so can be used in situations where curl is not enabled.

When you need to communicate with another application over HTTP, the most common transfer format is one of two flavors of XML: XML-RPC and SOAP. PHP5 contains excellent built-in SOAP support, and Zend Framework provides Zend_XmlRpc_Client to allow for easy processing of XML-RPC. More recently, the lightweight JSON (JavaScript Object Notation) protocol has been gaining favor, mainly due to how easy it is to process within the JavaScript of an Ajax application. Zend_Json provides a nice solution to both creating and reading JSON data.

Web Services Components

Zend Framework provides a rich set of functionality to allow access to services provided by other suppliers. These components cover generic RSS feeds along with specific components for working with the public APIs from Google, Yahoo!, and Amazon. RSS has come a long way from its niche among the more technologically minded bloggers and is now used by the majority of news sites. Zend_Feed provides a consistent interface to reading feeds in the various RSS and Atom versions that are available without having to worry about the details.

Google, Yahoo!, Amazon, and other websites have provided public APIs to their online services in order to encourage developers to create extended applications around the core service. For Amazon, the API provides access to the data on in the hope that the new application will encourage more sales. Similarly, Yahoo! provides API access to its Flickr photo data in order to allow additional services for Flickr users, such as the print service provided by The traditional Yahoo! properties such as search, news, and images are also available. Zend Framework groups these and many more components into a set of classes prefixed with Zend_Service. There is Zend_Service_Amazon, Zend_Service_Delicious, Zend_Service_Simpy, Zend_Service_SlideShare, and Zend_Service_Yahoo to name but a few within this family.

Google has a number of online applications allowing for API access that are supported by the Zend_Gdata component. Zend_Gdata provides access to Google’s Blogger, Calendar, Base, YouTube, and Code Search applications. In order to provide consistency, the Zend_Gdata component provides the data using Zend_Feed, so if you can process an RSS feed, you can process Google Calendar data too.

Core Components

There is a set of other components provided with Zend Framework that do not fit easily into any category, so we have grouped them together into the core category. This potpourri of components includes classes for caching, searching, and PDF creation. The rather esoteric measurement class is also in this category.

Everyone wants a faster website, and caching is one tool that can be used to help speed up your site. While it’s not a sexy component, the Zend_Cache component provides a generic and consistent interface for caching any data in a variety of backend systems, such as disks, databases, or even APC’s shared memory. This flexibility ensures that you can start small with Zend_Cache, and as the load on your site increases, the caching solution can grow to help ensure you get the most out of your server hardware.

Every modern website provides a search facility, but most are so terrible that the site’s users would rather search Google than use the site’s own system. Zend_Search_Lucene is based on the Apache Lucene search engine for Java and provides an industrial-strength text-search system that will allow your users to find what they are looking for. As required by a good search system, Zend_Search_Lucene supports ranked searching (so that the best results are at the top) along with a powerful query system.

Another core component is Zend_Pdf, which can create PDF files programmatically. PDF is a very portable format for documents intended for printing. You can control the position of everything on the page with pixel-perfect precision, without having to worry about differences in the way web browsers render the page. Zend_Pdf is written entirely in PHP and can create new PDF documents or load existing ones for editing.

Zend Framework provides a strong email component, Zend_Mail, to allow for sending emails in plain text or HTML. As with all Zend Framework components, the emphasis is on flexibility and sensible defaults. Within the world of email, this means that the component allows for sending email using SMTP or via the standard PHP mail() command. Additional transports can easily be slotted into the system by writing a new class that implements Zend_Mail_Transport_Interface. When sending email, an object-oriented interface is used:

$mail = new Zend_Mail();
$mail->setBodyText('My first email!')
 ->setBodyHtml('My <b>first</b> email!')
 ->setFrom('', 'Rob Allen')
 ->addTo('', 'Some Recipient')
 ->setSubject('Hello from Zend Framework in Action!')

This snippet also shows the use of fluent interfaces—each member function returns an object instance so that the functions can be chained together to make the code more readable. Fluent interfaces are commonly used in Zend Framework classes in order to make the classes easier to use.

As you can appreciate, Zend Framework contains a comprehensive set of components that provide most of the foundations for a website. As the framework continues to grow, even more components will be added, and all components will follow Zend Framework’s design philosophy, which ensures the quality and consistency of the framework.

1.4. Zend Framework Design Philosophy

Zend Framework has a number of published goals that make up the design philosophy of the framework. If these goals do not mesh with your views on developing PHP applications, Zend Framework is unlikely to be a good fit for your way of doing things. All components in the framework meet these goals, which ensures the usefulness of the framework code going into the future.

1.4.1. High-quality Components

All code within the Zend Framework library will be of high quality. This means that it will be written using PHP5’s features and will not generate any messages from the PHP parser (that is, it is E_STRICT compliant). This means that any PHP parser messages in your logs come from your code, not the framework, which helps considerably when debugging! Zend Framework also defines high quality to include documentation, so the manual for a given component is as important as the code.

It is intended that entire applications can be developed with no external library dependencies (unless you want them). This means that Zend Framework is a “full stack” framework (like Ruby on Rails or the Django Python framework) rather than a set of disjointed components, though much less tightly coupled. This will ensure that there will be consistency in the components: how they are named, how they work, and how the files are laid out in subdirectories. Having said that, it is important to emphasize that Zend Framework is modular with few dependencies between modules. This ensures that it plays well with other frameworks and libraries and that you can use as much or as little as you want. For example, if you only want PDF generation, you don’t have to use the MVC system.

1.4.2. Pragmatism and Flexibility

Another design goal for the framework is the mantra “Don’t change PHP.” The PHP way is simple, with pragmatic solutions, and Zend Framework is intended to reflect that and to provide a simple solution for mainstream developers. Zend Framework is also powerful enough to allow for specialized usage via extensions. The core developers have done a great job in covering the common scenarios and providing “flex points” to easily allow changes to be made to the default behavior by those who want something more powerful or specialized.

1.4.3. Clean IP

All contributors to Zend Framework have signed a Contributor License Agreement (CLA). This is an agreement with Zend that ensures the intellectual property status of the contribution. That is, the contributors warrant that (to the best of their knowledge), they are entitled to make the contribution and that no one else’s intellectual property rights are being infringed upon. This is intended to help protect all users of the framework from potential legal issues related to intellectual property and copyright. The risk is minimal, but the legal action brought by SCO against AutoZone showed that a litigator going after the user of the allegedly copyright-infringing code is a possibility. As with everything, it is better to be prepared.

Zend Framework’s source code is licensed under the new BSD license. This provides users with a lot of freedom to use the code in many different applications from open source projects to commercial products. When combined with the clean IP requirements, Zend Framework is well-positioned for use by anyone for any purpose.

1.4.4. Support from Zend Technologies

An obvious but important consideration is that Zend Framework is supported by Zend Technologies. This means that the framework is unlikely to die due to inactivity of the core developers or by not being updated to the latest and greatest version of PHP. Zend Technologies also has the resources to provide full-time developers on the project to help move it forward at a consistent pace.

We have now covered Zend Framework in some detail, looking at why it exists, what it contains, and its overall goals. A lot of PHP frameworks meet the needs of different programmers, so let’s look at where Zend Framework sits compared to some other frameworks.

1.5. Alternative PHP Frameworks

Considering that the usage of PHP is so broad, no one framework is going to suit everyone. There are many other frameworks vying for your attention in the PHP world, and all have their strengths and weaknesses. Table 1.1 lists some of the strengths and weaknesses of these frameworks. We have rather arbitrarily picked four frameworks that all have some traction in the community, but these are by no means the only choices.

Table 1.1. Key features of Zend Framework, CakePHP, CodeIgniter, Solar, and Symfony


Zend Framework





Uses PHP5 to full advantage Yes No No Yes Yes
Prescribed directory structure No (Optional recommended structure) Yes Yes No Yes
Official internationalization support Yes In progress for version 1.2 No Yes Yes
Command line scripts required to setup framework No No No No Yes
Requires configuration Yes (minor amount) No No Yes Yes
Comprehensive ORM provided No Yes No No Yes (Prople)
Good documentation and tutorials Yes Yes Yes Yes Yes
Unit tests for source available Yes No No Yes Yes
Community support Yes Yes Yes Yes (some) Yes
License New BSD MIT BSD-style New BSD MIT

While this book is about Zend Framework, the other frameworks are worth investigating to see if they better match your requirements. If you still need to support PHP4, you will need to use either CakePHP or CodeIgniter because the rest do not support PHP4. In this day and age, however, it’s time to leave PHP4 behind us as it has been officially discontinued.

1.6. Summary

In this chapter, we have looked at what Zend Framework is and why it is useful for writing web applications. It enables rapid development of enterprise applications by providing a comprehensive set of components using best practices in object-oriented design. The framework contains many components, from an MVC controller through to a PDF generator to a powerful search tool. Zend Framework has a set of design principles that ensure the code is of high quality and is well documented. A CLA is in place for all contributions, so the risk of IP issues with the framework is minimized, and with Zend Technologies committed to maintaining the framework, we can be sure of the long-term future for applications built on this technology.

This book is about providing real-world examples, so we’ll have Ajax technology built in wherever it is appropriate. Now, let’s move on to the core topic of this book and look at a how to build a simple, but complete, Zend Framework application in Chapter 2.