Skip to content

A repository of some of the most common OOP design patterns written in PHP.

Notifications You must be signed in to change notification settings

marisudris/Design-Patterns-In-PHP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GoF Design Patterns in PHP

A little learning repo I've created for myself, exploring a couple of patterns from the Design Patterns: Elements of Reusable Object-Oriented Software that could be relevant for PHP (with some examples).

A design pattern is a proven technique which helps solve a recurring problem in software design. Each design pattern helps maximize code reuse and lets some aspect of system vary independently of other aspects, thereby making the system more robust to a particular type of change and facilitating other good coding principles, like SOLID.

Design patterns are classified into 3 distinct categories:

Some of the patterns I've explored here - and aspects that can vary freely without introducing breaking changes in the system.

Creational Patterns:

Structural Patterns:

  • Adapter - instance of an object
  • Decorator - responsibilities of an object, without subclassing it
  • Composite - structure and composition of an object
  • Facade - interface to a subsystem
  • Bridge - implementation of an object

Behavioral Patterns:

  • Strategy - the exact algorithm used
  • State - state of an object
  • Observer - number of objects that depend on an other object (subject), and how those dependent object stay up to date with the subject
  • Command - when and how a request is fulfilled
  • Template Method - steps of an algorithm
  • Iterator - how an aggregate object's elements are accessed/traversed
  • Chain of Responsibility - which object fulfills the request

About

A repository of some of the most common OOP design patterns written in PHP.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages