© Kelt Dockins 2017

Kelt Dockins, Design Patterns in PHP and Laravel, 10.1007/978-1-4842-2451-9_15

15. Proxy

Kelt Dockins

(1)Dolph, Arkansas, USA

$> git checkout proxy

Intent

Provide a surrogate or placeholder for another object to control access to it.1

Applications

Proxies are the man-in-the-middle pattern. Instead of a client directly calling some object method, the incoming call first communicates with the proxy. Similar to a decorator, the proxy wraps itself around an object. Unlike the decorator, the proxy does not live to add new functionality to the wrapped object. So why do you use proxies? Why have a man in the middle? There are a few good reasons why you might do this and out of these reasons arise different types of proxies. These different ...

Get Design Patterns in PHP and Laravel now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.