Hey, I have just reduced the price for all products. Let's prepare our programming skills for the post-COVID era. Check it out »
Mediator

Mediator in PHP

Mediator is a behavioral design pattern that reduces coupling between components of a program by making them communicate indirectly, through a special mediator object.

The Mediator makes it easy to modify, extend and reuse individual components because they’re no longer dependent on the dozens of other classes.

Usage of the pattern in PHP

Complexity:

Popularity:

Usage examples: The pure implementation of the Mediator pattern isn’t as common in PHP, as it’s in other languages, especially GUI-targeted like Java or C#. A PHP application may indeed contain dozens of components, but they rarely communicate directly within a single session.

However, there are still uses for the Mediator pattern like the event dispatchers of many PHP frameworks or some implementations of MVC controllers.

Mediator in Other Languages

Design Patterns: Mediator in Java Design Patterns: Mediator in C# Design Patterns: Mediator in C++ Design Patterns: Mediator in Python Design Patterns: Mediator in Ruby Design Patterns: Mediator in Swift Design Patterns: Mediator in TypeScript Design Patterns: Mediator in Go