Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time
April 16, 2021 17:18
September 23, 2014 12:16
September 23, 2014 12:16
September 23, 2014 12:16
October 31, 2022 12:24

Proxy Manager

A message to Russian πŸ‡·πŸ‡Ί people

If you currently live in Russia, please read this message.


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


Mutation testing badge Type Coverage

Total Downloads Latest Stable Version Latest Unstable Version


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 for looking into issues related to this package in your private projects.


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(
    function (& $wrappedObject, $proxy, $method, $parameters, & $initializer) {
        $wrappedObject = new \MyApp\HeavyComplexObject(); // instantiation logic here
        $initializer   = null; // turning off further lazy initialization

        return true; // report success


See the documentation for more supported proxy types and examples.