ProxyManager

by Ocramius

Ocramius / ProxyManager

🎩✨🌈 OOP Proxy wrappers utilities - generates and manages proxies of your objects

4.0K Stars 151 Forks Last release: about 2 months ago (2.9.1) MIT License 2.8K Commits 51 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

Proxy Manager

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

ProxyManager

Mutation testing badge Type Coverage

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.

ocramius/proxy-manager for enterprise

Available as part of the Tidelift Subscription.

The maintainer of ocramius/proxy-manager and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. Learn more..

You can also contact the maintainer at [email protected].com for looking into issues related to this package in your private projects.

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

$proxy->doFoo();

See the documentation for more supported proxy types and examples.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.