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 2w 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 57% 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

1558d 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

[iazaran/smart-cache

Smart Cache is a caching optimization package designed to enhance the way your Laravel application handles data caching. It intelligently manages large data sets by compressing, chunking, or applying other optimization strategies to keep your application performant and efficient.

21114.2k](/packages/iazaran-smart-cache)

PHPackages © 2026

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