Yannick Warnier 76a0eae5ea Add static resources and remove tests dir for beta release | 5 жил өмнө | |
---|---|---|
.. | ||
doc-template | 5 жил өмнө | |
docs | 5 жил өмнө | |
src | 5 жил өмнө | |
CHANGELOG.md | 5 жил өмнө | |
LICENSE | 5 жил өмнө | |
README.md | 5 жил өмнө | |
STABILITY.md | 5 жил өмнө | |
UPGRADE.md | 5 жил өмнө | |
composer.json | 5 жил өмнө | |
couscous.yml | 5 жил өмнө | |
phpbench.json | 5 жил өмнө | |
proxy-manager.svg | 5 жил өмнө |
This library aims at providing abstraction for generating various kinds of proxy classes.
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
Here's how you build a lazy loadable object with ProxyManager using a Virtual Proxy
$factory = new \ProxyManager\Factory\LazyLoadingValueHolderFactory();
$proxy = $factory->createProxy(
\MyApp\HeavyComplexObject::class,
function (& $wrappedObject, $proxy, $method, $parameters, & $initializer) {
$wrappedObject = new HeavyComplexObject(); // instantiation logic here
$initializer = null; // turning off further lazy initialization
}
);
$proxy->doFoo();
See the online documentation for more supported proxy types and examples.