Fabulous PHP frameworks: Zend Framework


Become An Insider

Sign up now and get free access to hundreds of Insider articles, guides, reviews, interviews, blogs, and other premium content from the best tech brands on the Internet: CIO, CSO, Computerworld, InfoWorld, IT World and Network World Learn more.

The Zend Framework offers a comprehensive feature set and popular components in return for a significant time investment

The Zend Framework, sponsored by Zend Technologies, is a comprehensive framework loaded with features. Currently at Version 1.11.2, it requires PHP 5.2.4 or later and makes full use of PHP 5's object-oriented features.

Zend Technologies also produces the Zend Server PHP application server. And while Zend Server is not required for Zend Framework, running Zend Framework applications on the Zend Server provides substantial benefits. First, Zend Framework provides a Zend_Log writer that writes to the Zend Server's monitor API, allowing you to use the Server's log introspection feature for drilling into application issues. Also, the Framework includes a Zend Server-specific Zend_Cache back end for caching resource-intensive operations, such as database results, Web service calls, complex templates, and more.

While Zend Framework supports the MVC (model view controller) design pattern, and most of the tutorials and examples employ that pattern, Zend does not lock you into its use. You can use MVC "pieces" instead. It's possible (though not necessarily optimal) to create a Zend Framework project using only view components. In fact, the Zend Framework's construction is modular enough that some PHP frameworks suggest employing its components for features they do not support directly.

Zend Framework uses the "front controller" pattern to manage responses to Web requests. (Most of the other frameworks do the same.) This means that all requests pass through a single index.php file, which acts as a kind of central switching system, routing each request to the responsible controller class. This not only simplifies request handling, but also ensures that the environment is properly initialized before the application performs any actions.

Zend Framework libraries and tools
Download and unpack Zend Framework, and you get a collection of libraries organized within a directory structure. Zend provides a command-line tool, zf, that jump-starts the creation of specific pieces of an application by generating scaffolding code, placing that code in the proper files, building the proper subdirectory structures, and storing each file in its correct subdirectory. To create an application, you define the application's Web root directory, then use the zf tool to build the directory structure using a command like the following:

zf create project <project-name>

This creates a <project-name> directory in the Web root and adorns that directory with all necessary subdirectories.

The zf tool also builds controllers, models, views, actions within controllers, and even data-entry forms. Suppose you've defined a database with a table that tracks music albums, and you want to create a skeletal class for accessing that table. You would enter the following:

Zend_Db does not implement an active record pattern (a pattern employed by default in Ruby on Rails). Zend engineers explained they decided not to on account of that pattern's shortcomings in performance and flexibility. They also decided not to implement an Object Relational Mapper (ORM) in Zend_Db, partly because ORMs are complex and -- in their words -- "difficult to get right," and partly because other projects, such as the Doctrine ORM, were already tackling ORM.

The Zend Framework team has partnered with the Dojo Foundation to provide first-class integration for the Dojo JavaScript toolkit. In addition, community volunteers have created tools for jQuery integration that mimic the support and API provided in the Dojo integration.

The Zend Framework's online documentation includes a programmer's reference guide, which also incorporates a quick-start introduction for neophytes. Other getting-started guides target specific components of the framework. For example, the website features a starter guide for the Zend_Search_Lucene component, which supports the Lucene full-text indexing and search system. Other resources on the website include a guide for improving application performance using intelligent class loading and an unfortunately brief section that covers database performance enhancements. Finally, the website is home to a collection of nearly 30 webinars on a wide range of topics such as application testing, debugging, security issues, AJAX, and more.

There is much to learn in the Zend Framework. If you're looking for a comprehensive library of PHP Web-building components, you're likely to find all you'll need in Zend. But if you want to get your website off the ground quickly, Zend is probably not your best choice.

Read the reviews of other PHP frameworks:

To continue reading, please begin the free registration process or sign in to your Insider account by entering your email address:
From CIO: 8 Free Online Courses to Grow Your Tech Skills
View Comments
You Might Like
Join the discussion
Be the first to comment on this article. Our Commenting Policies