atheon / proxy-manager
一个提供生成、实例化和操作对象代理的实用程序的库
2.15.0
2022-10-25 14:39 UTC
Requires
- php: ^8.0
- composer-runtime-api: ^2.1.0
- laminas/laminas-code: ^4.4.2
- webimpress/safe-writer: ^2.2.0
Requires (Dev)
- ext-phar: *
- codelicia/xulieta: ^0.1.6
- doctrine/coding-standard: ^9.0.0
- phpbench/phpbench: ^1.0.3
- phpunit/phpunit: ^9.5.6
- roave/infection-static-analysis-plugin: ^1.8
- squizlabs/php_codesniffer: ^3.6.0
- vimeo/psalm: ^4.8.1
Suggests
- laminas/laminas-json: To have the JsonRpc adapter (Remote Object feature)
- laminas/laminas-soap: To have the Soap adapter (Remote Object feature)
- laminas/laminas-xmlrpc: To have the XmlRpc adapter (Remote Object feature)
- ocramius/generated-hydrator: To have very fast object to array to object conversion for ghost objects
Conflicts
- thecodingmachine/safe: <1.3.3
Replaces
- ocramius/proxy-manager: 2.15.0
- 2.15.x-dev
- 2.15.0
- 2.14.x-dev
- 2.14.1
- 2.14.0
- 2.13.x-dev
- 2.13.1
- 2.13.0
- 2.12.x-dev
- 2.12.1
- 2.12.0
- 2.11.x-dev
- 2.11.2
- 2.11.1
- 2.11.0
- 2.10.x-dev
- 2.10.2
- 2.10.1
- 2.10.0
- 2.9.x-dev
- 2.9.2
- 2.9.1
- 2.9.0
- 2.8.x-dev
- 2.8.2
- 2.8.1
- 2.8.0
- 2.7.x-dev
- 2.7.2
- 2.7.1
- 2.7.0
- 2.6.x-dev
- 2.6.2
- 2.6.1
- 2.6.0
- 2.5.x-dev
- 2.5.3
- 2.5.2
- 2.5.1
- 2.5.0
- 2.4.x-dev
- 2.4.1
- 2.4.0
- 2.3.x-dev
- 2.3.2
- 2.3.1
- 2.3.0
- 2.2.x-dev
- 2.2.4
- 2.2.3
- 2.2.2
- 2.2.1
- 2.2.0
- 2.1.1
- 2.1.0
- 2.0.4
- 2.0.3
- 2.0.2
- 2.0.1
- 2.0.0
- 2.0.0-BETA3
- 2.0.0-BETA2
- 2.0.0-BETA1
- 1.0.2
- 1.0.1
- 1.0.0
- 1.0.0-beta3
- 1.0.0-beta2
- 1.0.0-beta1
- 0.5.2
- 0.5.1
- 0.5.0
- 0.5.0-BETA3
- 0.5.0-BETA2
- 0.5.0-BETA1
- 0.4.1
- 0.4.0
- 0.3.6
- 0.3.5
- 0.3.4
- 0.3.3
- 0.3.2
- 0.3.1
- 0.3.0
- 0.2.0
- 0.1.0
- dev-dependabot/composer/twig/twig-2.15.3
- dev-psalm-fix
- dev-fix/#427-proxying-magic-methods-with-void-return-declaration
- dev-fix/#346-magic-methods-hints-reproducibility
- dev-experiment/better-reflection-integration
This package is not auto-updated.
Last update: 2024-09-25 22:08:30 UTC
README
给俄罗斯🇷🇺人民的信
如果您目前居住在俄罗斯,请阅读此信息。
目的
此库旨在提供生成各种代理类的抽象。
文档
您可以在文档中了解代理模式以及如何使用ProxyManager。
ocramius/proxy-manager for enterprise
作为Tidelift订阅的一部分提供。
ocramius/proxy-manager的维护者以及数千个其他包的维护者正在与Tidelift合作,为构建应用程序时使用的开源依赖项提供商业支持和维护。节省时间,降低风险,提高代码质量,同时为使用的确切依赖项支付维护者的费用。了解更多。
您还可以通过ocramius@gmail.com联系维护者,以解决与您私人项目相关的此包的问题。
安装
建议的安装方法是使用composer
php composer.phar require ocramius/proxy-manager
代理示例
这是使用虚拟代理通过ProxyManager构建可延迟加载对象的方法
$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 return true; // report success } ); $proxy->doFoo();
有关更多支持的代理类型和示例,请参阅文档。