🎉 Hooray! After 3 years of work, I've finally released the ebook on design patterns! Check it out »
Proxy

Proxy in PHP

Proxy is a structural design pattern that provides an object that acts as a substitute for a real service object used by a client. A proxy receives client requests, does some work (access control, caching, etc.) and then passes the request to a service object.

The proxy object has the same interface as a service, which makes it interchangeable with a real object when passed to a client.

Learn more about Proxy

Usage of the pattern in PHP

Complexity:

Popularity:

Usage examples: While the Proxy pattern isn’t a frequent guest in most PHP applications, it’s still very handy in some special cases. It’s irreplaceable when you want to add some additional behaviors to an object of some existing class without changing the client code.

Proxy in Other Languages

Design Patterns: Proxy in Java Design Patterns: Proxy in C# Design Patterns: Proxy in Python Design Patterns: Proxy in Ruby Design Patterns: Proxy in Swift Design Patterns: Proxy in TypeScript