PHPackages                             rapidwebltd/caching-object-wrapper - 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. rapidwebltd/caching-object-wrapper

ActiveLibrary[Caching](/categories/caching)

rapidwebltd/caching-object-wrapper
==================================

Wraps up any PHP object so all its methods are cached.

v1.0.2(8y ago)220LGPL-3.0-onlyPHPPHP &gt;=5.6

Since Mar 21Pushed 8y ago2 watchersCompare

[ Source](https://github.com/rapidwebltd/caching-object-wrapper)[ Packagist](https://packagist.org/packages/rapidwebltd/caching-object-wrapper)[ RSS](/packages/rapidwebltd-caching-object-wrapper/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (3)Dependencies (4)Versions (4)Used By (0)

🎁 Caching Object Wrapper
========================

[](#-caching-object-wrapper)

[![Build Status](https://camo.githubusercontent.com/8b32ef514c7cee560e34976ce663f3cf01936fe326459fdfa63a89a24f0fefee/68747470733a2f2f7472617669732d63692e6f72672f72617069647765626c74642f63616368696e672d6f626a6563742d777261707065722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/rapidwebltd/caching-object-wrapper)[![Coverage Status](https://camo.githubusercontent.com/b1f93d212ff2ae802b5d231d4e5aeae2c57fc7d2346b7f8da059dfccc2de6aa7/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f72617069647765626c74642f63616368696e672d6f626a6563742d777261707065722f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/rapidwebltd/caching-object-wrapper?branch=master)[![StyleCI](https://camo.githubusercontent.com/9c8f38d7966e49b4f8dcbccd5ba75248755d34863ed77bc523fbe426ca18f2a0/68747470733a2f2f7374796c6563692e696f2f7265706f732f3132363138313730372f736869656c643f6272616e63683d6d6173746572)](https://styleci.io/repos/126181707)

Wraps up any PHP object so all its methods are cached.

Installation
------------

[](#installation)

You can install this package easily via Composer. Just run the following command from the root of your project.

```
composer require rapidwebltd/caching-object-wrapper

```

Usage
-----

[](#usage)

Here is a very simple usage example, showing how we can easily cache a simple object.

```
use RapidWeb\CachingObjectWrapper\CachingObjectWrapper;
use rapidweb\RWFileCachePSR6\CacheItemPool;

// This is an example class that we are going to use. It just generates random numbers.
class RandomNumberGenerator
{
    public function generate()
    {
        return rand();
    }
}

// First, we need to install and setup a PSR6 cache item pool.
// As an example, we'll use the PSR-6 adapter for RW File Cache.

// $ composer require rapidwebltd/rw-file-cache-psr-6

$cache = new CacheItemPool();
$cache->changeConfig(
    [
        'cacheDirectory'  => '/tmp/cow-tests/',
        'gzipCompression' => true,
        ]
    );

// Next, we can wrap up a new RandomNumberGenerator.
// We also pass in the $cache object we just created, and the desired cache expiry time in seconds.

$randomNumberGenerator = new CachingObjectWrapper(new RandomNumberGenerator(), $cache, 60 * 60);

// That's it!
// To test, we can tell the wrapped object to generate us two random numbers.

$randomNumber1 = $randomNumberGenerator->generate();
$randomNumber2 = $randomNumberGenerator->generate();

// Due to our caching, $randomNumber1 and $randomNumber2 should be identical.
```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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

2971d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c580cdf7c14898fff179cdfc1085892091d5d2f49d917873a12365af9ac77c93?d=identicon)[Jord-JD](/maintainers/Jord-JD)

---

Top Contributors

[![Jord-JD](https://avatars.githubusercontent.com/u/650645?v=4)](https://github.com/Jord-JD "Jord-JD (3 commits)")

---

Tags

cachecachingphpphp-librarypsr-6wrapper

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/rapidwebltd-caching-object-wrapper/health.svg)

```
[![Health](https://phpackages.com/badges/rapidwebltd-caching-object-wrapper/health.svg)](https://phpackages.com/packages/rapidwebltd-caching-object-wrapper)
```

###  Alternatives

[symfony/cache

Provides extended PSR-6, PSR-16 (and tags) implementations

4.2k348.9M2.5k](/packages/symfony-cache)[symfony/cache-contracts

Generic abstractions related to caching

2.4k308.9M198](/packages/symfony-cache-contracts)[tedivm/stash

The place to keep your cache.

9824.8M124](/packages/tedivm-stash)[league/flysystem-cached-adapter

An adapter decorator to enable meta-data caching.

35426.9M119](/packages/league-flysystem-cached-adapter)[laminas/laminas-cache

Caching implementation with a variety of storage options, as well as codified caching strategies for callbacks, classes, and output

1076.9M130](/packages/laminas-laminas-cache)[cache/adapter-common

Common classes for PSR-6 adapters

11124.4M37](/packages/cache-adapter-common)

PHPackages © 2026

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