Skip to content
🌈 OOP Proxy wrappers utilities - generates and manages proxies of your objects
PHP
Branch: master
Clone or download

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Merge pull request #606 from malukenho/enable-xulieta-on-ci May 15, 2020
docs Fix documentation examples with codelicia/xulieta May 12, 2020
examples Fix property initializers in ghost object examples Jan 14, 2020
src/ProxyManager #574 typed properties **must** be unset like any other property to tr… Apr 7, 2020
tests Corrected docblock alignment according to CS config Apr 13, 2020
.gitattributes export docs and examples Mar 27, 2020
.gitignore composer remove --dev couscous/couscous Aug 28, 2019
.phpstorm.meta.php Added `PHPSTORM_META` to help with the various proxy factories inters… Jun 3, 2019
CHANGELOG.md Fix documentation examples with codelicia/xulieta May 12, 2020
CONTRIBUTING.md Tidied up contributing doc May 12, 2018
LICENSE EOF EOL Sep 23, 2014
README.md Using "enterprisey" wording for Tidelift in `README.md` Oct 29, 2019
SECURITY.md Created SECURITY.md for security disclosures Oct 29, 2019
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 Update vimeo/psalm requirement from ^3.11.2 to ^3.11.5 Jun 1, 2020
infection.json.dist Infection no longer supports JSON logs Feb 27, 2019
phpbench.json Aggregate report is usually what is needed Jul 1, 2016
phpcs.xml.dist Merge branch '2.5.x' Jan 7, 2020
phpdox.xml.dist EOF EOL fixes Sep 23, 2014
phpmd.xml.dist EOF EOL fixes Sep 23, 2014
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
psalm.xml Update Psalm and suppress a few issues Apr 13, 2020

README.md

Proxy Manager

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

ProxyManager

Build Status Code Coverage Scrutinizer Quality Score SensioLabsInsight

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 ocramius@gmail.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.

You can’t perform that action at this time.