Table of Contents

Chapter 1. Introducing Framework-Driven Development

It’s difficult to fully appreciate the convenience of using a tool such as the Zend Framework without understanding the powerful development paradigms upon which such tools are built. In this chapter I’ll introduce you to several key paradigms, notably the concepts of convention over configuration, the power of staying DRY, and problem solving using design patterns.

Chapter 2. Creating Your First Zend Framework Project

In this chapter you’ll learn how to install and configure the Zend Framework, and use the framework’s command line tool to create your first Zend Framework-powered website. You’ll also learn how to expand the website by creating and managing key application components such as controllers, actions, and views.

Chapter 3. Managing Layouts, Views, CSS, Images, and JavaScript

Modern website user interfaces are an amalgamation of templates, page-specific layouts, CSS files, images and JavaScript code. The Zend Framework provides a great number of features which help reduce the complexities involved in effectively integrating and maintaining these diverse components, and in this chapter you’ll learn all about them.

Chapter 4. Managing Configuration Data

Most websites rely upon a great deal of configuration data such as database connection parameters, directory paths, and web service API keys. The challenges of managing this data increases when you consider that it will often change according to your website’s lifecycle stage (for instance the production website’s database connection parameters will differ from those used during development). The Zend Framework’s Zend_Config component was created to address these challenges in mind, and in this chapter you’ll learn how to use this component to maintain configuration data for each stage of your website’s lifecycle.

Chapter 5. Creating Web Forms with Zend_Form

HTML forms are one of the most commonplace features found on a website, yet there seems to be countless ways to implement them. The Zend Framework’s Zend_Form component brings order to this important process, providing tools for not only auto-generating your forms, but also making available clear procedures for validating and processing the data. In this chapter you’ll learn how Zend_Form can remove all of the implementational vagaries from your form construction and processing tasks.

Chapter 6. Talking to the Database with Zend_Db

These days it’s rare to create a website which doesn’t involve some level of database integration. Although PHP makes it easy to communicate with a database such as MySQL, this can be a double-edged sword because it often leads to a confusing mishmash of PHP code and SQL execution statements. Further, constantly replacing the PHP developer and SQL developer hats can quickly become tiresome. The Zend Framework’s MVC implementation and Zend_Db component goes a long way towards removing both of these challenges, and in this chapter you’ll learn how.

Chapter 7. Integrating Doctrine 2

The Zend_Db component presents a significant improvement over the traditional approach to querying databases using PHP, however an even more powerful solution named Doctrine is now at your disposal. A full-blown object-relational mapping solution, Doctrine 2 provides developers with an impressive array of features capable of not only interacting with your database using an object-oriented interface, but can also make schema management almost enjoyable.

Chapter 8. Managing User Accounts

Whether you’re building an e-commerce site or would prefer readers of your blog register before adding comments, you’ll need an effective way to create user accounts and allow users to easily log into and out of the site. Further, you’ll probably want to provide users with tools for customizing the website according to personal preferences. Accomplishing all of these tasks is easily done using Zend_Auth and Zend_Session, and this chapter introduces you to both components.

Chapter 9. Creating Rich User Interfaces with JavaScript and Ajax

What’s a website without a little eye candy? In a mere five years since the term was coined, Ajax-driven interfaces have become a mainstream fixture of websites large and small. Yet the challenges involved in designing, developing and debugging Ajax-driven features remain. In this chapter I’ll introduce you to JavaScript, the jQuery JavaScript library, and show you how to integrate Ajax features into your website.

Chapter 10. Integrating Web Services

Every web framework sports a particular feature which sets it apart from the competition. In the Zend Framework’s case, that feature is deep integration with many of the most popular web services, among them Amazon’s EC2, S3, and Affiliate services, more than ten different Google services including Google Calendar and YouTube, and Microsoft Azure. In this chapter I’ll show you how easy it is to use the Zend Framework’s Zend_Service_Amazon component to talk to the Amazon Product Advertising API. You’ll also learn how to create command line-based PHP scripts which can take advantage of not only Zend Framework components but also the very same configuration settings used in your web application in order to carry out web service-based batch updates.

Chapter 11. Unit Testing Your Project

Most of the preceding chapters include a special concluding section devoted to explaining how to use the Zend Framework’s Zend_Test component to test the features introduced in the chapter, however because properly configuring Zend_Test is often a source of much confusion, I thought it worth devoting an entire chapter to the matter in the hopes of helping others to surpass many of the obstacles that I and others encountered when first attempting to use this powerful component.

Chapter 12. Deploying Your Website with Capistrano

Lacking an automated deployment process can be the source of significant pain, particularly as you need to update the production site to reflect the latest updates and bug fixes. In this chapter I’ll show you how to wield total control over the deployment process using a great build system known as Phing.