This book is no longer published or available for sale. See our Main Book page for a list of available books.

You have probably heard a lot about Design Patterns — a technique that helps you design rock-solid solutions to practical problems that programmers everywhere encounter in their day-to-day work.

Even though there has been a lot of buzz, however, no-one has yet come up with a comprehensive resource on design patterns for PHP developers—until today.

Author Jason E. Sweat’s book php|architect’s Guide to PHP Design Patterns is the first comprehensive guide to design patterns designed specifically for the PHP developer. This book includes coverage of 16 design patterns with a specific eye to their applications in PHP when building complex web applications, both in PHP 4 and PHP 5 (where appropriate, sample code for both versions of the language is provided).

As you can expect from a php|architect book, this Guide is very focused on its topic, with none of the fluff that accompanies the large, expensive “500-page monsters” you sometimes find at the bookstore. Naturally, this doesn’t come at the expense of depth of coverage or clarity: the book contains tens of scripts that give you a practical overview of every topic covered, from top to bottom.

Table of Contents

  • Preface
  • Programming Practices
  • The ValueObject Pattern
  • The Factory Pattern
  • The Singleton Pattern
  • The Registry Pattern
  • The MockObject Pattern
  • The Strategy Pattern
  • The Iterator Pattern
  • The Observer Pattern
  • The Specification Pattern
  • The Proxy Pattern
  • The Decorator Pattern
  • The Adapter Pattern
  • The ActiveRecord Pattern
  • The TableDataGateway Pattern
  • The DataMapper Pattern
  • The Model-View-Controller Pattern
  • Conclusion


  • Patterns Quick Reference
  • SimpleTest Testing Practices

You can download the book’s code zip file here.