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

ActiveLibrary[Caching](/categories/caching)

codeigniter4/cache
==================

PSR-6 and PSR-16 Cache Adapters for CodeIgniter 4

v1.0.0(4y ago)1320.1k—5.6%4[1 PRs](https://github.com/codeigniter4/cache/pulls)MITPHPPHP ^7.3 || ^8.0CI passing

Since Sep 14Pushed 1y ago6 watchersCompare

[ Source](https://github.com/codeigniter4/cache)[ Packagist](https://packagist.org/packages/codeigniter4/cache)[ Docs](https://github.com/codeigniter4/cache)[ RSS](/packages/codeigniter4-cache/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelog (1)Dependencies (11)Versions (4)Used By (0)

CodeIgniter 4 PSR Cache
=======================

[](#codeigniter-4-psr-cache)

PSR-6 and PSR-16 Cache Adapters for CodeIgniter 4

[![](https://github.com/codeigniter4/cache/workflows/PHPUnit/badge.svg)](https://github.com/codeigniter4/cache/actions/workflows/phpunit.yml)[![](https://github.com/codeigniter4/cache/workflows/PHPStan/badge.svg)](https://github.com/codeigniter4/cache/actions/workflows/phpstan.yml)[![](https://github.com/codeigniter4/cache/workflows/Deptrac/badge.svg)](https://github.com/codeigniter4/cache/actions/workflows/deptrac.yml)[![Coverage Status](https://camo.githubusercontent.com/25b3e425182c3c3bb155c7590ebb467e9b7d6b5fa63397e14dcc6aff49a4944b/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f636f646569676e69746572342f63616368652f62616467652e7376673f6272616e63683d646576656c6f70)](https://coveralls.io/github/codeigniter4/cache?branch=develop)

**Disclaimer: CodeIgniter 4 comes with a fully-functional cache component! This module is only for integrating third-party packages that rely on the PSR interface provisions.**

Quick Start
-----------

[](#quick-start)

1. Install with Composer: `> composer require codeigniter4/cache`
2. Integrate with your favorite packages:

```
use CodeIgniter\Psr\Cache\SimpleCache;
use Kreait\Firebase\Factory;
...

$factory = (new Factory)->withVerifierCache(new SimpleCache());
```

Features
--------

[](#features)

A set of adapters fully-compliant with PSR-6 and PSR-16 to integrate with CodeIgniter 4's Caching Driver.

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

[](#installation)

Install easily via Composer to take advantage of CodeIgniter 4's autoloading capabilities and always be up-to-date:

- `> composer require codeigniter4/cache`

Or, install manually by downloading the source files and adding the directory to `app/Config/Autoload.php`.

Usage
-----

[](#usage)

This module has adapters for CodeIgniter 4 to supply the following FIG PHP Standards Recommendations (PSR):

- [Caching Interface](https://www.php-fig.org/psr/psr-6)
- [Simple Cache](https://www.php-fig.org/psr/psr-16)

If you just need a caching agent then you should use the framework's native [Caching Driver](https://codeigniter4.github.io/CodeIgniter4/libraries/caching.html). These adapters are intended to integrate with any library or project that requires either of the following:

- [psr/cache-implementation](https://packagist.org/packages/psr/cache/dependents?order_by=downloads)
- [psr/simple-cache-implementation](https://packagist.org/packages/psr/simple-cache/dependents?order_by=downloads)

The interfaces are provided by the following classes:

- `Psr\Cache\CacheItemInterface` provided by `CodeIgniter\Psr\Cache\Item`
- `Psr\Cache\CacheItemPoolInterface` provided by `CodeIgniter\Psr\Cache\Pool`
- `Psr\SimpleCache\CacheInterface` provided by `CodeIgniter\Psr\Cache\SimpleCache`

By default the adapters (`Pool` and `SimpleCache`) will work with the Caching Driver as defined in you cache configuration (e.g. **app/Config/Cache.php**). You may create either driver explicitly with an alternative Cache Handler or Config:

```
    $sharedCacheServicePool = new \CodeIgniter\Psr\Cache\Pool();

    $fileHandler = new \CodeIgniter\Cache\Handlers\FileHandler(config('Cache'));
    $explicitFileHandlerSimpleCache = new \CodeIgniter\Psr\Cache\SimpleCache($fileHandler);

    $config = config('Cache');
    $config->prefix = 'banana-';
    $alternativeConfigPool = new \CodeIgniter\Psr\Cache\Pool($config);
```

Testing
-------

[](#testing)

Testing of the underlying Caching Driver is handled in the [CodeIgniter 4 repo](https://github.com/codeigniter4/CodeIgniter4/tree/develop/tests/system/Cache). These adapters are tested with the [PHP Cache Integration Tests](https://github.com/php-cache/integration-tests), by Aaron Scherer. You may run the test suite by cloning this repo, installing all dependencies, and running:

- `> composer test`

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance30

Infrequent updates — may be unmaintained

Popularity35

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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

Unknown

Total

1

Last Release

1707d ago

### Community

Maintainers

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

---

Top Contributors

[![kenjis](https://avatars.githubusercontent.com/u/87955?v=4)](https://github.com/kenjis "kenjis (33 commits)")[![samsonasik](https://avatars.githubusercontent.com/u/459648?v=4)](https://github.com/samsonasik "samsonasik (27 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (26 commits)")[![MGatner](https://avatars.githubusercontent.com/u/17572847?v=4)](https://github.com/MGatner "MGatner (24 commits)")[![ddevsr](https://avatars.githubusercontent.com/u/97607754?v=4)](https://github.com/ddevsr "ddevsr (1 commits)")

---

Tags

codeignitercachepsr-16psr-6poolcodeigniter4simplecache

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[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/simple-cache-bridge

A PSR-6 bridge to PSR-16. This will make any PSR-6 cache compatible with SimpleCache.

423.1M27](/packages/cache-simple-cache-bridge)

PHPackages © 2026

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