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

Installs: 31 172 521

Dependents: 300

Suggesters: 39

Stars: 3 062

Watchers: 48

Forks: 122

Open Issues: 48

2.5.0 2019-08-10 10:43 UTC


This library aims to provide abstraction for generating various kinds of proxy classes.


Build Status Code Coverage Scrutinizer Quality Score SensioLabsInsight

Total Downloads Latest Stable Version Latest Unstable Version


You can learn about the proxy pattern and how to use the ProxyManager in the docs.

Professional Support

Professionally supported ocramius/proxy-manager is available through Tidelift .

You can also contact the maintainer at ocramius@gmail.com for looking into issues related to this package in your private projects.


The suggested installation method is via composer:

php composer.phar require ocramius/proxy-manager

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 \MyApp\HeavyComplexObject(); // instantiation logic here
        $initializer   = null; // turning off further lazy initialization


See the documentation for more supported proxy types and examples.