PHPackages                             coercive/cache - 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. coercive/cache

ActiveLibrary[Caching](/categories/caching)

coercive/cache
==============

Coercive Utility Cache

0.1(4y ago)11.3kMITPHP &gt;=7.4

Since Oct 16Pushed 4y ago2 watchersCompare

[ Source](https://github.com/Coercive/Cache)[ Packagist](https://packagist.org/packages/coercive/cache)[ Docs](http://coercive.fr)[ RSS](/packages/coercive-cache/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (10)DependenciesVersions (13)Used By (0)

Coercive Utility Cache
======================

[](#coercive-utility-cache)

Simple cache helpers.

Get
---

[](#get)

```
composer require coercive/cache

```

JSON
----

[](#json)

```
use Coercive\Utility\Cache

# Load your cache instance for a defined project
$json = new Json('/temp/my_project_directory')

# Set a global default expire delay
$json = new Json('/temp/my_project_directory', 'P1D')
# OR
$json->setExpireDelay('P1D')

# Retrieve your data
$data = $json->get('data-key')

# Save your data
$json->set('data-key', ['data1', 'data2'])

# Save your data with specific expire delay
$json->set('data-key', ['data1', 'data2'], 'PT15M')

# Delete specific data
$json->delete('data-key')

# Empty cache
$json->clear()

# You can enable/disable the cache
$json->disable()
$json->enable()
$json->setState(bool)

# If cache disable
$json->get('data-key') => return null
```

PHP
---

[](#php)

```
use Coercive\Utility\Cache

# Load your cache instance for a defined project
$php = new Php('/temp/my_project_directory')

# Set a global default expire delay
$php = new Php('/temp/my_project_directory', 'P1D')
# OR
$php->setExpireDelay('P1D')

# Retrieve your data
$data = $php->get('data-key')

# Save your data
$php->set('data-key', ['data1', 'data2'])

# Save your data with specific expire delay
$php->set('data-key', ['data1', 'data2'], 'PT15M')

# Delete specific data
$php->delete('data-key')

# Empty cache
$php->clear()

# You can enable/disable the cache
$php->disable()
$php->enable()
$php->setState(bool)

# If cache disable
$php->get('data-key') => return null
```

Global
------

[](#global)

```
use Coercive\Utility\Cache

# Use debug method to handle exceptions
$cache->debug(function($e) {
    /** @var Exception $e */
    echo $e->getMessage();
    // do something
});

# You can also expose all exceptions
var_dump($cache->getExceptions());
```

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

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 ~151 days

Recently: every ~261 days

Total

12

Last Release

1466d ago

PHP version history (4 changes)0.0.1PHP &gt;=7

0.0.8PHP &gt;=7.1

0.0.11PHP &gt;=7.0

0.1PHP &gt;=7.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/20288080?v=4)[Coercive](/maintainers/Coercive)[@Coercive](https://github.com/Coercive)

---

Top Contributors

[![Coercive](https://avatars.githubusercontent.com/u/20288080?v=4)](https://github.com/Coercive "Coercive (11 commits)")

---

Tags

cachejsonphp

### Embed Badge

![Health badge](/badges/coercive-cache/health.svg)

```
[![Health](https://phpackages.com/badges/coercive-cache/health.svg)](https://phpackages.com/packages/coercive-cache)
```

###  Alternatives

[predis/predis

A flexible and feature-complete Redis/Valkey client for PHP.

7.8k305.7M2.4k](/packages/predis-predis)[snc/redis-bundle

A Redis bundle for Symfony

1.0k39.4M67](/packages/snc-redis-bundle)[react/cache

Async, Promise-based cache interface for ReactPHP

444112.4M40](/packages/react-cache)[wp-media/wp-rocket

Performance optimization plugin for WordPress

7431.3M3](/packages/wp-media-wp-rocket)[illuminate/cache

The Illuminate Cache package.

12835.6M1.4k](/packages/illuminate-cache)[colinmollenhour/php-redis-session-abstract

A Redis-based session handler with optimistic locking

6325.6M14](/packages/colinmollenhour-php-redis-session-abstract)

PHPackages © 2026

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