A library providing utilities to generate, instantiate and generally operate with Object Proxies

Installs: 1 068 970

Dependents: 89

Stars: 465

Watchers: 26

Forks: 62

Open Issues: 23

1.0.2 2015-08-09 04:28 UTC


This library aims at providing abstraction for generating various kinds of proxy classes.


Build Status Code Coverage Scrutinizer Quality Score SensioLabsInsight Dependency Status Reference Status HHVM Status

Total Downloads Latest Stable Version Latest Unstable Version


You can learn about the proxy pattern and how to use the ProxyManager on the online documentation.




The suggested installation method is via composer:

php composer.phar require ocramius/proxy-manager:1.0.*

Proxy example

Here's how you build a lazy loadable object with ProxyManager using a Virtual Proxy

$factory = new \ProxyManager\Factory\LazyLoadingValueHolderFactory();

$proxy = $factory->createProxy(
    function (& $wrappedObject, $proxy, $method, $parameters, & $initializer) {
        $wrappedObject = new HeavyComplexObject(); // instantiation logic here
        $initializer   = null; // turning off further lazy initialization


See the online documentation for more supported proxy types and examples.