Design Pattern: Visitor Pattern in PHP

Visitor pattern moves the calculation/operation to a separate class. This way, we can define a new operation without changing the related classes. This article demonstrates Visitor pattern implementations in PHP.

Design Pattern: Template Method Pattern in PHP

Template method pattern defines a template/skeleton for an operation processing steps. The subclasses define some steps of the template/skeleton, and some step definitions can be common for all. This makes it easier for the subclasses to adopt the processing steps defined in the template method pattern. This article demonstrates Template Method pattern implementations in PHP.

Design Pattern: Strategy Pattern in PHP

Strategy pattern uses a group of similar algorithms and make those algorithms interchangeable. The client can use any of the algorithms at any given time and also can change the algorithm when needed. The algorithms used in strategy has the same interface implemented, but the internal working is different. This article demonstrates Strategy pattern implementations in PHP.

Design Pattern: State Pattern in PHP

State pattern implements a system where an object is able to change its behavior based on state(one or more properties) of that object. The behavior can change completely or partially. This article demonstrates State pattern implementations in PHP.

Design Pattern: Observer Pattern in PHP

Observer pattern implements a publish/subscribe mechanism between objects. Some subscribing objects want to observe the state change of a specific object, and the observer pattern enables the publishing object(subject) to notify other objects about changes. This article demonstrates Observer pattern implementations in PHP.

Design Pattern: Memento Pattern in PHP

Memento pattern keeps track of the internal state of an object, so that the program can track back and restore to any previous state of the object. This pattern enables us to implement the undo of any state change. This article demonstrates Memento pattern implementations in PHP.

Design Pattern: Mediator Pattern in PHP

Mediator pattern encapsulates the logic of communication between a bunch of defined objects. A mediator object is used for that. The mediator works as a middleman between the set of objects. This prevents the objects(colleagues) from communicating directly with each other, and ensures loose coupling. This article demonstrates Mediator pattern implementations in PHP.

Design Pattern: Interpreter Pattern in PHP

Interpreter pattern represents the grammar or syntax rules of an expression. Parsing the expression and evaluation is implemented in the pattern implementation. The implementation can be for a specific syntax of a specific type of expression. A specific set of rules is defined for parsing and evaluation/operation. In this article, we are discussing the implementation of the Interpreter pattern in PHP.

Design Pattern: Iterator Pattern in PHP

Iterator pattern is used to access items sequentially from an aggregated object. The client does not need to know the underlying details of the iterator, it can just use the iterator easily. This pattern makes it very easy for the client to traverse through a list of objects, one by one. It can also implement the traversing process in any order (ascending or descending) if required. This article demonstrates the Iterator pattern implementation in PHP.

Design Pattern: Command Pattern in PHP

Command pattern encapsulates a full request in an object. So, the object can be passed as a parameter or can be queued or saved in log. Later the object can be revived and we get the full request, which can be executed and/or undoned at any point in time. This article demonstrates Command pattern implementations in PHP.