ProxyManager

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

Github星跟踪图

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.

主要指标

概览
名称与所有者Ocramius/ProxyManager
主编程语言PHP
编程语言PHP (语言数: 1)
平台
许可证MIT License
所有者活动
创建于2013-03-19 09:43:22
推送于2025-05-02 12:04:00
最后一次提交
发布数71
最新版本名称2.14.1 (发布于 2022-03-05 18:43:44)
第一版名称0.1.0 (发布于 2013-03-23 07:41:47)
用户参与
星数5k
关注者数46
派生数192
提交数3k
已启用问题?
问题数289
打开的问题数36
拉请求数355
打开的拉请求数15
关闭的拉请求数132
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?