Skip to content

A curated collection of PHP examples demonstrating common design patterns, organized by type: Creational, Structural, and Behavioral. Ideal for learning and referencing clean, scalable software design.

Notifications You must be signed in to change notification settings

kareemzayed/Design-Patterns

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 

Repository files navigation

🎯 PHP Design Patterns

This repository provides a comprehensive collection of Design Pattern examples in PHP, neatly organized into the three main pattern categories:

  • Creational
  • Structural
  • Behavioral

Each pattern is implemented in clean, modern PHP code with concise examples to help developers understand their intent and use cases.


🧱 Pattern Categories

πŸ”¨ Creational Patterns

These patterns deal with object creation mechanisms. They aim to reduce complexity and increase flexibility in instantiating objects.

Examples:

  • Singleton
  • Factory Method
  • Abstract Factory
  • Builder
  • Prototype

πŸ—οΈ Structural Patterns

Structural patterns explain how to assemble objects and classes into larger structures while keeping these structures flexible and efficient.

Examples:

  • Adapter
  • Bridge
  • Composite
  • Decorator
  • Facade
  • Proxy
  • Flyweight

πŸ€– Behavioral Patterns

Behavioral patterns focus on communication between objects, helping to ensure that systems are both flexible and maintainable.

Examples:

  • Strategy
  • Observer
  • State
  • Command
  • Chain of Responsibility
  • Template Method
  • Iterator
  • Mediator

πŸ“ Folder Structure

β”œβ”€β”€ creational/
β”‚   └── [PatternName]/
β”‚       └── *.php
β”œβ”€β”€ structural/
β”‚   └── [PatternName]/
β”‚       └── *.php
β”œβ”€β”€ behavioral/
β”‚   └── [PatternName]/
β”‚       └── *.php

About

A curated collection of PHP examples demonstrating common design patterns, organized by type: Creational, Structural, and Behavioral. Ideal for learning and referencing clean, scalable software design.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published