PHP design patterns

In this blog we are going to lern about PHP design patterns/ web design patterns. what is design patterns, how to use them, where to use them. Which design pattern is good in what scenario.

what is design patterns?
Design pattern is a general reusable solution which is used to resolved a commonly occurring problem within a given context. It is a description or template or ideal way for how to solve a problem that can be used in many different situations. So patterns are formalised best practices that you must implement yourself in your application.

what does design patterns do?
Most of the object oriented design patterns show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved. Many patterns imply object-orientation or more generally mutable state, and so may not be as applicable in functional programming languages, in which data is immutable or treated as such.

It’s difficult to explain all the details about the design patterns. It may the case you are already using same method for a while but you may not be knowing that that method is been knows as some pattern. so i am presuming that you have a little sense of what design patterns are and why they’re useful, it’s time to jump into five common patterns for PHP.

Design Patterns are mainly divided into three patterns.
1. Creational Design Patterns
2. Behavioral Design Patterns
3. Structural Design Patterns

Above three patterns are farther categorised into list of sub patterns and lets move to what all different type of patterns fall under these categories.

1. Creational Design Patterns:
1) Singleton Design Patterns
2) Factory Design Patterns
3) Factory Method Design Patterns
4) Abstract Factory Design Patterns
5) Builder Design Patterns
6) Prototype Design Patterns
7) Object pool Design Patterns

2. Behavioral Design Patterns
1) Chain of Responsibility Design Patterns
2) Command Design Patterns
3) Interpreter Design Patterns
4) Iterator Design Patterns
5) Mediator Design Patterns
6) Observer Design Patterns
7) Strategy Design Patterns
9) Template Method Design Patterns
10) Visitor Design Patterns
11) Null Object Design Patterns

3. Structural Design Patterns
1) Adapter Design Patterns
2) Bridge Design Patterns
3) Composite Design Patterns
4) Decorator Design Patterns
5) Flyweight Design Patterns
6) Memento Design Patterns
7) Proxy Design Patterns

Share this nice post:

2 thoughts on “PHP design patterns

  1. Thank you for your wonderful post! It continues to be very insightful. I wish that you’ll continue posting your wisdom with us.

Leave a Reply

Your email address will not be published. Required fields are marked *