Skip to content

php-design-patterns is a collection of PHP examples demonstrating various design patterns, including Behavioral, Creational, and Structural patterns.

Notifications You must be signed in to change notification settings

legrch/php-design-patterns

Repository files navigation

Design Patterns in PHP

This repository contains examples of common design patterns implemented in PHP.

Behavioral Behavioral Creational Creational Structural Structural
Chain of Responsibility Abstract Factory Adapter
Command Builder Bridge
Interpreter Factory Method Composite
Iterator Prototype Decorator
Mediator Singleton Facade
Memento Flyweight
Observer Proxy
State
Strategy
Template Method
Visitor

Design Patterns Categories

Class Relationships

The following relationship types are used in the UML diagrams throughout this repository:

Aggregation Aggregation - Describes a "whole-part" relationship where the "part" can exist independently of the "whole". The diamond is placed on the "whole" side.

Composition Composition - A subtype of aggregation in which the "parts" cannot exist separately from the "whole".

Dependency Dependency - A dashed arrowhead line indicates a class that instantiates objects of another class. The arrow points to the class of the instantiated objects.

Generalization Generalization - Represents inheritance or interface implementation relationships. The arrow points to the superclass or interface.

Installation and Testing

  1. Clone the repository
  2. Run composer install
  3. Execute tests with vendor/bin/phpunit

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

php-design-patterns is a collection of PHP examples demonstrating various design patterns, including Behavioral, Creational, and Structural patterns.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages