Subscribe

Subscribe to our newsletter or follow us on Twitter and receive big discounts when new books are available!


Buy the first edition of this e-book (includes 3+ hours of companion video) for just $15 and you will receive the forthcoming second edition for free!


Beta Chapters

Chapter 00. Introduction

Chapter 01. Introducing Framework-Driven Development

Chapter 02. Creating Your First Zend Framework Application

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


To add a comment, click on the desired paragraph! I'll add more features in coming releases. I have tested the beta site using Google Chrome and Firefox 3.6.8. Opera is currently buggy.

Easy PHP Websites with the Zend Framework, 2E

Introduction

The Web Ain't What It Used to Be

The World Wide Web's technical underpinnings are incredibly easy and intuitive to understand, a characteristic which has contributed perhaps more than anything else to this revolutionary communication platform's transformational growth over the past 15 years or so. Its also this trait which I believe have led so many developers horribly astray, because while the web's plumbing remains decidely free of complexity even today, the practice of developing web sites has evolved into something decidely more complex than perhaps ever would have been imagined even a decade ago.

Despite this transformation, far too many developers continue to treat web development as something separate from software development. Yet with the Web having become an indispensable part of much of the planet's personal and business affairs, it is no longer acceptable to treat an enterprise-level website as anything but an application whose design, development, deployment, and lifecycle is governed by rigorous process. Embracing a rigorous approach to designing, developing, testing and deploying websites will make you a far more productive and worry free developer, because your expectations of what should be and realization of what is are identical.

If you quietly admit to not having yet embraced a formalized development process, I can certainly empathize. For years I too grappled with tortuous code refactoring, unexpected side effects due to ill-conceived updates, and generally found the testing and deployment process to be deeply steeped in voodoo. After having been burned by yet another problematic bit of code, a few years ago I decided to step back from the laptop and take the time to learn how to develop software rather than merely write code. One of the first actionable steps I took in this quest was to embrace what was at the time a fledgling project called the Zend Framework. This step served as the basis for reevaluating practically everything I've come to know about the software development process, and it has undoubtedly been the most reinvigorating experience of my professional career.

If you too have grown weary of writing code in a manner similar to Shakespeare's typing monkeys, hoping that with some luck a masterpiece will eventually emerge, and instead want to start developing software using the patterns, practices, and strategies of developers who seem to be unable to do any wrong, you'll find the next 12 chapters not only transformational, but rather fun.

Book Contents

This book introduces several of the most commonly used features of the Zend Framework, organizing these topics into the following twelve chapters:

Chapter 1. The Power of Paradigms

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 Application

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 carry out the task. 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 donning and removing the PHP developer and SQL developer hats can quickly become tiresome and error prone. 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

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 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 Sessions with Zend_Auth and Zend_Session

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 login and logout 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 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-oriented features remain. In this chapter I'll show you how to integrate these hyper-responsive features into your website with minimal trouble.

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 offload your database data to Microsoft Azure, and make certain website updates are known to the world via the Twitter API.

Chapter 11. Doing Test-Driven Development

Most of the preceding chapters include a special section devoted to explaining how to use the Zend Framework's Zend_Test component to test the code presented therein, however because properly configuring Zend_Test is such a source of pain and 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 Phing

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.

Reader Expectations

You presumably expect that I possess a certain level of knowledge and experience pertaining to PHP and the Zend Framework. The pages which follow will determine whether I've adequately met those expectations. Likewise, in order for you to make the most of the material in this book, you should possess a basic understanding of the PHP language, at least a conceptual understanding of object-oriented programming and preferably PHP's particular implementation, and a basic grasp of Structured Query Language (SQL) syntax, in addition to fundamental relational database concepts such as datatypes and joins.

If you do not feel comfortable with any of these expectations, then while I'd imagine you will still benefit somewhat from the material, chances are you'll have a lot more to gain after having read my book Beginning PHP and MySQL, Fourth Edition, which you can purchase from WJGilmore.com.

Downloading the Source Code

The source code for this book is available for download at http://www.wjgilmore.com.

Contact the Author

I love responding to reader questions and feedback, and can almost guarantee you'll receive a response from me, many times within minutes of receiving your e-mail. Get in touch at wj@wjgilmore.com

Please wait...