Design Patterns
The classic patterns with practical examples, one per page.
❯ start with part 1Design Patterns
A short introduction to Design Patterns, with practical examples in PHP
Design patterns: Singleton
The Singleton design pattern with PHP examples
Design patterns: Factory Method
The Factory Method design pattern with examples in PHP
Design patterns: Abstract Factory
The Abstract Factory design pattern with examples in PHP
Design patterns: Builder
The Builder design pattern with examples in PHP
Design patterns: Prototype
The Prototype design pattern with PHP examples
Design patterns: Adapter
The Adapter design pattern with examples in PHP
Design patterns: Bridge, What It Is and How to Use It (PHP)
The Bridge pattern explained: separating abstraction from implementation, its benefits and a PHP example with payment methods (credit card, PayPal) and personal or business accounts.
Design patterns: Composite
The Composite design pattern with examples in PHP
Design patterns: Decorator
The Decorator design pattern with examples in PHP
Design patterns: Facade, What It Is and How to Use It (PHP)
The Facade pattern explained: what it is for, its benefits and a full PHP example, a single facade over a cinema's movie catalog, ticket office and users.
Design patterns: Flyweight
The Flyweight design pattern with examples in PHP
Design patterns: Proxy
The Proxy design pattern with PHP examples
Design patterns: Chain of Responsibility Explained (PHP)
The Chain of Responsibility pattern explained: what it is for, its benefits and a PHP example with a three-level support chain: basic, advanced and administrator.
Design patterns: Command
The Command pattern with examples in PHP
Design patterns: Interpreter
The Interpreter pattern with examples in PHP
Design patterns: Iterator
The Iterator pattern with PHP examples
Design patterns: Mediator
The Mediator pattern with PHP examples
Design patterns: Memento
The Memento pattern with PHP examples
Design patterns: Observer
The Observer pattern with PHP examples
Design patterns: State, What It Is and How to Use It (PHP)
The State pattern explained: what it is for, its benefits and a PHP example with a coffee machine that changes behavior depending on its state (no coin, has coin, dispensing).
Design patterns: Strategy
The Strategy pattern with PHP examples
Design patterns: Template Method
The Template Method pattern with PHP examples
Design patterns: Visitor
The Visitor pattern with PHP examples