Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Ocramius/ProxyManager
๐ฉโจ๐ OOP Proxy wrappers/utilities - generates and manages proxies of your objects
https://github.com/Ocramius/ProxyManager
aop lazy-loading oop proxy
Last synced: 7 days ago
JSON representation
๐ฉโจ๐ OOP Proxy wrappers/utilities - generates and manages proxies of your objects
- Host: GitHub
- URL: https://github.com/Ocramius/ProxyManager
- Owner: Ocramius
- License: mit
- Created: 2013-03-19T09:43:22.000Z (over 11 years ago)
- Default Branch: 2.15.x
- Last Pushed: 2024-10-28T13:29:11.000Z (14 days ago)
- Last Synced: 2024-10-29T19:21:07.745Z (13 days ago)
- Topics: aop, lazy-loading, oop, proxy
- Language: PHP
- Homepage:
- Size: 4.44 MB
- Stars: 4,958
- Watchers: 48
- Forks: 187
- Open Issues: 50
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
- awesome-php - ProxyManager - A set of utilities to generate proxy objects for data mappers. (Table of Contents / Database)
- awesome-php-cn - ProxyManager - ไธ็ปๅฎ็จ็จๅบๆฅ็ๆไปฃ็ๅฏน่ฑก่ฟ่กๆฐๆฎๆ ๅฐๅจ. (็ฎๅฝ / ๆฐๆฎๅบ Database)
- awesome-projects - ProxyManager - A set of utilities to generate proxy objects for data mappers. (PHP / Database)
- awesome-php - ProxyManager - A set of utilities to generate proxy objects for data mappers. (Table of Contents / Database)
README
# Proxy Manager
## A message to Russian ๐ท๐บ people
If you currently live in Russia, please read [this message](./ToRussianPeople.md).
## Purpose
This library aims to provide abstraction for generating various kinds of
[proxy classes](http://ocramius.github.io/presentations/proxy-pattern-in-php/).![ProxyManager](https://raw.githubusercontent.com/Ocramius/ProxyManager/917bf1698243a1079aaa27ed8ea08c2aef09f4cb/proxy-manager.png)
[![Mutation testing badge](https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2FOcramius%2FProxyManager%2Fmaster)](https://dashboard.stryker-mutator.io/reports/github.com/Ocramius/ProxyManager/master)
[![Type Coverage](https://shepherd.dev/github/Ocramius/ProxyManager/coverage.svg)](https://shepherd.dev/github/Ocramius/ProxyManager)[![Total Downloads](https://poser.pugx.org/ocramius/proxy-manager/downloads.png)](https://packagist.org/packages/ocramius/proxy-manager)
[![Latest Stable Version](https://poser.pugx.org/ocramius/proxy-manager/v/stable.png)](https://packagist.org/packages/ocramius/proxy-manager)
[![Latest Unstable Version](https://poser.pugx.org/ocramius/proxy-manager/v/unstable.png)](https://packagist.org/packages/ocramius/proxy-manager)## Documentation
You can learn about the proxy pattern and how to use the **ProxyManager** in the [docs](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.](https://tidelift.com/subscription/pkg/packagist-ocramius-proxy-manager?utm_source=packagist-ocramius-proxy-manager&utm_medium=referral&utm_campaign=enterprise&utm_term=repo).
You can also contact the maintainer at [email protected] for looking into issues related to this package
in your private projects.## Installation
The suggested installation method is via [composer](https://getcomposer.org/):
```sh
php composer.phar require ocramius/proxy-manager
```## Proxy example
Here's how you build a lazy loadable object with ProxyManager using a *Virtual Proxy*
```php
$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 initializationreturn true; // report success
}
);$proxy->doFoo();
```See the [documentation](docs) for more supported proxy types and examples.