🌈 OOP Proxy wrappers utilities - generates and manages proxies of your objects
Latest commit 8d0fa8e Oct 19, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
doc-template Docs: Fix mixed content loading Jun 27, 2017
docs Using newer (working) presentation link May 14, 2018
examples Applied doctrine/coding-standard to the examples Aug 25, 2018
html-docs Redirecting to new documentation URIs in `html-docs` (to be removed i… Mar 19, 2015
src/ProxyManager Removed unused imports Sep 27, 2018
tests Removed unrelated test file Sep 27, 2018
.gitattributes Migrating from `humbug/humbug` to `infection/infection` Aug 25, 2018
.gitignore Migrating from `humbug/humbug` to `infection/infection` Aug 25, 2018
.scrutinizer.yml Remove php 7.x from allowed failure Apr 8, 2015
.travis.coverage.sh Uploading coverage when the PHP version matches 7.2 Nov 15, 2017
.travis.install.sh Simplifying travis installation steps, since HHVM is no longer part o… Nov 15, 2017
.travis.yml .travis.yml: Allow php 7.3 on matrix Oct 19, 2018
CHANGELOG.md ProxyManager 2.2.0 release notes Nov 16, 2017
CONTRIBUTING.md Tidied up contributing doc May 12, 2018
LICENSE EOF EOL Sep 23, 2014
README.md Tidied up the docs and simply removed weasel words May 12, 2018
STABILITY.md extend date for bug fixes and security fixes for 2.0.x version Jan 3, 2017
UPGRADE.md #272 - PHP 4 constructors are no longer supported Jan 28, 2016
composer.json Moved to psr-4 Sep 10, 2018
couscous.yml Correcting couscous base directory Mar 19, 2015
infection.json.dist Migrating from `humbug/humbug` to `infection/infection` Aug 25, 2018
phpbench.json Aggregate report is usually what is needed Jul 1, 2016
phpcs.xml.dist Removed dead config in PHPCS configuration Aug 25, 2018
phpdox.xml.dist EOF EOL fixes Sep 23, 2014
phpmd.xml.dist EOF EOL fixes Sep 23, 2014
phpstan.neon Static analysis on sources and tests in one pass Aug 26, 2018
phpunit.xml.dist Corrected test suite name to avoid requiring escaping when passing it… Aug 25, 2018
proxy-manager.png Including rasterized version of the logo (renders on github) Nov 9, 2013
proxy-manager.svg Removing licence also from the logo Jul 31, 2017


Proxy Manager

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


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

Total Downloads Latest Stable Version Latest Unstable Version


You can learn about the proxy pattern and how to use the ProxyManager in the docs, which are also compiled to HTML.




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 online documentation for more supported proxy types and examples.