

Download the source for the Navigation Menu.
Goal: This easy project will combine powerful tools with some simple components to produce a flexible navigation menu capable of displaying horizontally or vertically with never-ending submenus.
Download the source for the Composite Pattern.
Download the source for the Iterator Pattern.
Iterators allow us to traverse through all the elements of a collection, regardless of how that collection is implemented. With the Iterator pattern, we have a way to encapsulate looping through a collection or array of objects. It can also be handy if you want to loop through different types of objects in a collection all without exposing the internal structure. Let’s create our own just to see how it’s done.
Download the source for the Template Pattern.
Encapsulation is one of the fundamental concepts of object-oriented programming: by hiding the internal mechanisms and data structure of an object behind an interface, users need only know what that object does and not how it is implemented with the added benefit of reducing system complexity. With the Template pattern we can encapsulate pieces of algorithms so they can be hooked into by subclasses.
Download the source for the Command Pattern.
The Command Pattern is a design pattern implemented for a multitude of purposes: progress bars, wizards, thread pools, multi-level undo, and networking to name a few. By encapsulating the request as an object, the Command Pattern allows us to parameterize other objects with different requests, queue or log those requests, and even support undo functionality.
Download the source for the Singleton Pattern.
Sometimes you may find yourself in need of an object that can exist once and only once, for example: registry settings, device drivers, or game objects. To do this we use a pattern aptly named the Singleton Pattern. The Singleton utilizes a private constructor and so can only be instantiated through a call to another method. Here is a basic Singleton.class.php:
Download the source for the Simple Factory Pattern.
The Factory Pattern defines an interface for creating an object, but let the subclasses decide which class to instantiate. The Factory method lets a class defer instantiation to subclasses providing a way to decouple the implementation of an object from it’s use allowing for a way to change or add new objects without affecting the Creator. Or in practical terms…
Download the source for the Decorator Pattern.
Ever need to add new or additional functionality to a class dynamically? Need to make a class that is open for extension but closed for modification? Then the Decorator pattern is for you. How? Simple, we will add a new class to wrap, or decorate, the original class.