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

ActiveLibrary[Caching](/categories/caching)

phant/cache
===========

Manage cache easily

2.2(3mo ago)14.6k↓73.2%12MITPHPPHP &gt;=8.1

Since Apr 14Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/PhantPHP/cache)[ Packagist](https://packagist.org/packages/phant/cache)[ RSS](/packages/phant-cache/feed)WikiDiscussions main Synced today

READMEChangelog (3)Dependencies (8)Versions (5)Used By (2)

Cache
=====

[](#cache)

Requirments
-----------

[](#requirments)

PHP &gt;= 8.1

Install
-------

[](#install)

`composer require phant/cache`

Usages
------

[](#usages)

Phant Cache implement the PSR-16 SimpleCache interface : `Psr\SimpleCache\CacheInterface`

### Init cache

[](#init-cache)

#### File

[](#file)

Store cache in file.

```
use Phant\Cache\File as CacheFile;

$cache = new CacheFile('path/cache/', 'my-cache-container', CacheFile::TTL_HOUR);
```

#### Runtime

[](#runtime)

Store cache in runtime memory.

```
use Phant\Cache\Runtime as CacheRuntime;

$cache = new CacheRuntime();
```

### Get or set

[](#get-or-set)

```
$val = $cache->getOrSet(
	'my-key',
	function () {
		return 'my-val';
	},
	$cache::TTL_HOUR
);
```

### Has (PSR-16 SimpleCache)

[](#has-psr-16-simplecache)

```
if ($cache->has('my-key')) {

}
```

### Set (PSR-16 SimpleCache)

[](#set-psr-16-simplecache)

```
$cache->set('my-key', 'my-val', $cache::TTL_HOUR);
```

### Get (PSR-16 SimpleCache)

[](#get-psr-16-simplecache)

```
$val = $cache->get('my-key');
```

### Delete (PSR-16 SimpleCache)

[](#delete-psr-16-simplecache)

```
$cache->delete('my-key');
```

### Set multiple (PSR-16 SimpleCache)

[](#set-multiple-psr-16-simplecache)

```
$cache->setMultiple([
	'my-key-1' => 'val-1',
	'my-key-2' => 'val-2',
	'my-key-3' => 'val-3',
], $cache::TTL_HOUR);
```

### Get multiple (PSR-16 SimpleCache)

[](#get-multiple-psr-16-simplecache)

```
foreach ($cache->getMultiple([
	'my-key-1',
	'my-key-2',
	'my-key-3',
]) as $val) {

}
```

### Delete multiple (PSR-16 SimpleCache)

[](#delete-multiple-psr-16-simplecache)

```
$cache->deleteMultiple([
	'my-key-1',
	'my-key-2',
	'my-key-3',
]);
```

### Clear (PSR-16 SimpleCache)

[](#clear-psr-16-simplecache)

```
$cache->clear();
```

###  Health Score

48

—

FairBetter than 93% of packages

Maintenance81

Actively maintained with recent releases

Popularity25

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 88.9% 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 ~480 days

Total

4

Last Release

100d ago

Major Versions

1.0 → 2.02022-04-14

PHP version history (2 changes)1.0PHP ^8.0

2.1PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/5ce749176c74e4c4fd7bd457cdad471fd1e0e14092259e60e7330724ce622dce?d=identicon)[Phant](/maintainers/Phant)

---

Top Contributors

[![lennyrouanet](https://avatars.githubusercontent.com/u/5269913?v=4)](https://github.com/lennyrouanet "lennyrouanet (8 commits)")[![YevicT](https://avatars.githubusercontent.com/u/229097821?v=4)](https://github.com/YevicT "YevicT (1 commits)")

---

Tags

file cachesimplecachecache managercache componentcache PSR-16cache component PSR-16

###  Code Quality

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.9M388](/packages/easycorp-easyadmin-bundle)[shopware/platform

The Shopware e-commerce core

3.4k1.5M3](/packages/shopware-platform)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.6M574](/packages/shopware-core)[oro/platform

Business Application Platform (BAP)

645143.5k115](/packages/oro-platform)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[simplesamlphp/simplesamlphp-module-oidc

A SimpleSAMLphp module adding support for the OpenID Connect protocol

5018.2k1](/packages/simplesamlphp-simplesamlphp-module-oidc)

PHPackages © 2026

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