Design Pattern: Factory Pattern in PHP

Factory pattern helps to separate the creator of the objects from the object classes. The creator/factory is responsible for generating objects. Factory implementation process is not strict or predefined. The implementation depends on how we want to identify different objects and generate those. In this article we are demonstrating the Factory pattern implementation in PHP programming language.

Design Pattern: Abstract Factory Pattern in PHP

Abstract factory pattern is used when we need multiple factories which produce related but different sets of objects. This pattern is generally used in relatively larger applications that deal with lots of classes of related classes but can be divided into multiple groups based on some criteria. This article discusses the Abstract Factory pattern implementations in PHP.

Design Pattern: Builder Pattern in PHP

Build pattern separates the object construction process from the object representation. This makes object construction easy, and clients can create the object step by step. That is why this pattern is suitable for complex object construction, as the construction responsibility is delegated to the producer/director and the builder. This article demonstrates Builder pattern implementations in PHP.

Design Pattern: Adapter Pattern in PHP

Adapter pattern is used to convert the interface of a class to another interface, so that the existing class can be adapted to the desired new behavior. This way an existing class can adapt to a new functionality with any direct change to it. Sometimes we want to use some existing class(es), for some functionality, but the interface of the classes does not match with the new requirement. Adapter pattern is used in that case. This article is about Adapter pattern implementations in PHP.

Design Pattern: Decorator Pattern in PHP

Decorator pattern dynamically attaches additional responsibility to an object. This pattern is used to extend functionality without affecting the existing implementation. If we just use inheritance, then we can extend the functionality of a class. But by using a decorator we can enhance/extend and/or change the functionality of an object at run time. This article demonstrates Decorator pattern implementation in PHP.

Design Pattern: Facade Pattern in PHP

Facade introduces a new interface for the client to interface with the underlying complex subsystem classes. This is a high-level interface that hides the subsystems from the clients. Facade uses the objects and method from the already existing class(subsystem) objects. It is the responsibility of the facade, to provide the desired functionality to the client, with simplicity. This article is about the Facade pattern implementation in PHP.