ocramius / proxy-manager
A library providing utilities to generate, instantiate and generally operate with Object Proxies
Installs: 79 321 628
Dependents: 268
Suggesters: 38
Security: 0
Stars: 4 958
Watchers: 48
Forks: 187
Open Issues: 50
Requires
- php: ~8.0.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
- 2.15.x-dev
- 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-renovate/phpunit-phpunit-11.x
- dev-renovate/all-minor-patch
- dev-renovate/vimeo-psalm-5.x
- dev-renovate/actions-cache-4.x
- dev-renovate/actions-checkout-4.x
- dev-renovate/doctrine-coding-standard-12.x
- dev-renovate/lock-file-maintenance
- 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 auto-updated.
Last update: 2024-10-28 13:29:09 UTC
README
A message to Russian 🇷🇺 people
If you currently live in Russia, please read this message.
Purpose
This library aims to provide abstraction for generating various kinds of proxy classes.
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 return true; // report success } ); $proxy->doFoo();
See the documentation for more supported proxy types and examples.