PHPackages                             mz/php-proxy - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Caching](/categories/caching)
4. /
5. mz/php-proxy

AbandonedArchivedLibrary[Caching](/categories/caching)

mz/php-proxy
============

Proxy utilities (i.e. caching proxy)

0.2(11y ago)023MITPHPPHP &gt;=5.3.0

Since Jul 18Pushed 11y ago1 watchersCompare

[ Source](https://github.com/m-zajac/php-proxy)[ Packagist](https://packagist.org/packages/mz/php-proxy)[ Docs](https://github.com/m-zajac/php-proxy)[ RSS](/packages/mz-php-proxy/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (4)Versions (4)Used By (0)

PHP proxy
=========

[](#php-proxy)

This library provides proxy classes with easily extendable behavior. Library includes ready for use caching proxy and lazy instantiation proxy.

Requirements and dependencies
=============================

[](#requirements-and-dependencies)

This library has no external dependencies, if installed with `--no-dev` option. Caching behavior memcache backend requires php `memcache` module to be enabled.

Installation
============

[](#installation)

```
php composer.phar require mz/php-proxy

```

Basic usage
===========

[](#basic-usage)

#### In-memory cache proxy

[](#in-memory-cache-proxy)

```
use MZ\Proxy\Shortcuts;

// object proxy
$object = new MyComplexClass();
$proxy = Shortcuts\wrapWithMemoryProxy($object, 5); // 5 seconds timeout (default = 0 - infinite)
$proxy->foo();  // executes foo, stores result in cache
$proxy->foo();  // returns cached result, real foo method is not executed
$proxy->bar();  // works here too
$property = $proxy->my_property  // exactly as $object->my_property
$proxy->my_property = 123; // exactly as $object->my_property = 123

// set cached methods
$proxy->proxySetMethods(array('foo', 'bar'));
$proxy->foo();  // cached
$proxy->bar();  // cached
$proxy->baz();  // not cached

$proxy->proxySetMethods(null); // all methods cached fro this point (default)

$callable = function() {
    // some time intensive code...
};
$proxy = Shortcuts\wrapWithMemoryProxy($callable);
$result = $proxy();  // executes function
$result = $proxy();  // returns cached result
```

#### Cache proxy with memcache

[](#cache-proxy-with-memcache)

```
use MZ\Proxy\Shortcuts;

$object = new MyComplexClass();

$memcache = new \Memcache();
$memcache->addServer('localhost', 11211);

$proxy = Shortcuts\wrapWithMemcacheProxy(
    $object,
    'memcache_prefix',
    $memcache
);

$result = $proxy->foo();  // executes foo
$result = $proxy->foo();  // returns cached result, real foo method is not executed
```

Concepts
========

[](#concepts)

[![class diagram](doc/diagram.jpg "Proxy concept class diagram")](doc/diagram.jpg)

Extending proxy behavior
========================

[](#extending-proxy-behavior)

TODO

Limitations
===========

[](#limitations)

Proxies do not implement subjects interface.

Examples
========

[](#examples)

TODO

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

3

Last Release

4322d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c0df00240ba1bd1c08f1ef79115cacc88feea352c777b4d48113407cd1ad8b52?d=identicon)[m-zajac](/maintainers/m-zajac)

---

Top Contributors

[![m-zajac](https://avatars.githubusercontent.com/u/354964?v=4)](https://github.com/m-zajac "m-zajac (4 commits)")

---

Tags

proxycachecaching proxy

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/mz-php-proxy/health.svg)

```
[![Health](https://phpackages.com/badges/mz-php-proxy/health.svg)](https://phpackages.com/packages/mz-php-proxy)
```

###  Alternatives

[psr/simple-cache

Common interfaces for simple caching

8.1k727.3M2.1k](/packages/psr-simple-cache)[psr/cache

Common interface for caching libraries

5.2k686.9M1.3k](/packages/psr-cache)[react/cache

Async, Promise-based cache interface for ReactPHP

444112.4M40](/packages/react-cache)[beste/in-memory-cache

A PSR-6 In-Memory cache that can be used as a fallback implementation and/or in tests.

2512.2M6](/packages/beste-in-memory-cache)[anahkiasen/flatten

A package for the Illuminate framework that flattens pages to plain HTML

33113.0k](/packages/anahkiasen-flatten)[rtcamp/nginx-helper

Cleans nginx's fastcgi/proxy cache or redis-cache whenever a post is edited/published. Also provides cloudflare edge cache purging with Cache-Tags.

23517.0k1](/packages/rtcamp-nginx-helper)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
