Design Pattern Modules

Learn PHP design patterns through interactive coding challenges. Work through the modules in order — each builds on the one before.

OOP Beginner

OOP Basics Refresher

Classes, interfaces, abstract classes, visibility, type hinting, late static binding.

OOP Intermediate

SRP, OCP & DIP

Single Responsibility, Open/Closed, and Dependency Inversion — the three principles you'll use in Modules 1-3.

OOP Intermediate

LSP, ISP & Composition

Liskov Substitution, Interface Segregation, and Composition over Inheritance.

Non-GoF Beginner

Dependency Injection / IoC

Learn how to decouple classes by injecting dependencies rather than hardcoding them.

Non-GoF Beginner

Service Pattern

Encapsulate business logic in dedicated service classes to keep controllers thin and logic reusable.

Non-GoF Intermediate

Repository Pattern

Abstract data access behind an interface so your business logic never depends on a specific storage mechanism.

GoF Intermediate

Factory Method

Centralise object creation so client code never needs to know which concrete class to instantiate.

Non-GoF Beginner

Data Transfer Object (DTO)

Carry structured data between layers with type safety instead of raw arrays.

GoF Intermediate

Strategy Pattern

Swap algorithms or behaviours at runtime by encapsulating each one behind a common interface.

GoF Intermediate

Facade Pattern

Provide a simplified, unified interface to a complex subsystem.

GoF Intermediate

Adapter Pattern

Convert an incompatible interface into one your application expects.

GoF Advanced

Decorator Pattern

Add responsibilities to objects dynamically by wrapping them.

GoF Advanced

Command Pattern

Encapsulate requests as objects to support queuing, logging, and undo operations.

GoF Advanced

Observer / Events

Define one-to-many dependencies so that when one object changes state, all dependents are notified.

Non-GoF Advanced

Capstone: Patterns in Concert

Combine Factory, Strategy, Decorator, and Observer in a real kiosk payment system.