sterntours/trunk/_vendor/ocramius/proxy-manager
Kevin Adametz 33458b2ca3 Update
2020-03-07 19:46:02 +01:00
..
doc-template Update 2020-03-07 19:46:02 +01:00
docs Update 2020-03-07 19:46:02 +01:00
src/ProxyManager Update 2020-03-07 19:46:02 +01:00
CHANGELOG.md Update 2020-03-07 19:46:02 +01:00
composer.json Update 2020-03-07 19:46:02 +01:00
couscous.yml Update 2020-03-07 19:46:02 +01:00
LICENSE Update 2020-03-07 19:46:02 +01:00
phpbench.json Update 2020-03-07 19:46:02 +01:00
proxy-manager.svg Update 2020-03-07 19:46:02 +01:00
README.md Update 2020-03-07 19:46:02 +01:00
STABILITY.md Update 2020-03-07 19:46:02 +01:00
UPGRADE.md Update 2020-03-07 19:46:02 +01:00

Proxy Manager

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

ProxyManager

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

Total Downloads Latest Stable Version Latest Unstable Version

Documentation

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

Help/Support

Gitter

Installation

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(
    \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.