GaryJones / ProxyManager

:rainbow: OOP Proxy wrappers utilities - generates and manages proxies of your objects

Home Page:http://ocramius.github.io/ProxyManager/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

About

:rainbow: OOP Proxy wrappers utilities - generates and manages proxies of your objects

http://ocramius.github.io/ProxyManager/

License:MIT License


Languages

Language:PHP 97.7%Language:CSS 1.5%Language:HTML 0.7%Language:Shell 0.1%