News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Matthew Weier O'Phinney's Blog:
Proxies in PHP
July 06, 2011 @ 08:10:08

In a new blog post Matthew Weier O'Phinney has taken a look at proxy objects (the Proxy design pattern) and how it differs from some of the other popular patterns.

Of the other patterns mentioned, the one closest to the Proxy is the Decorator. In the case of a Decorator, the focus is on adding functionality to an existing object -- for instance, adding methods, processing input before delegating to the target object, or filtering the return of a method from a target object.

Proxies stand in for objects and have several benefits for your application that may or may not need all of the overhead a full object could cause. Matthew focuses on one benefit in particular - consuming and controlling access to another object. He sets up a problem of wanting to use properties/methods on objects that aren't exposed directly (like a protected method). His solution is a proxy layer class on top of the original object. He includes a few "gotchas" to look out for when using this technique including overwriting all necessary methods and copying over all of the needed properties.

0 comments voice your opinion now!
proxy designpattern object access method property


blog comments powered by Disqus

Similar Posts

Derick Rethans' Blog: PHP Vikinger 2008 Wrap-up

DevShed: Creating a Blog Application with Interpreter Classes with PHP 5

Matthew Weier O'Phinney's Blog: Proxies in PHP

Chris Hartjes' Blog: Fat Models, Skinny Controllers

Lukas Smith's Blog: Its the end of the world as we know it.


Community Events

Don't see your event here?
Let us know!


security laravel5 voicesoftheelephpant extension laravel language library release podcast community series version interview threedevsandamaybe unittest framework introduction opinion symfony api

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework