PHPackages                             silviooosilva/cacheer-php - 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. [Database &amp; ORM](/categories/database)
4. /
5. silviooosilva/cacheer-php

ActiveLibrary[Database &amp; ORM](/categories/database)

silviooosilva/cacheer-php
=========================

CacheerPHP is a minimalist package for caching in PHP, offering a simple interface for storing and retrieving cached data using multiple backends.

v4.7.7(2mo ago)28933[1 PRs](https://github.com/CacheerPHP/CacheerPHP/pulls)1MITPHPPHP &gt;=8.0

Since Jul 18Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/CacheerPHP/CacheerPHP)[ Packagist](https://packagist.org/packages/silviooosilva/cacheer-php)[ Docs](https://github.com/silviooosilva)[ RSS](/packages/silviooosilva-cacheer-php/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (6)Versions (55)Used By (1)

CacheerPHP
==========

[](#cacheerphp)

 [![CacheerPHP Logo](./art/cacheer_php_logo__.png)](https://github.com/silviooosilva/CacheerPHP)

[![Maintainer](https://camo.githubusercontent.com/3a24f7f9521210d6e5784931e9c55dc1d66d889e8ff828ecd51eed01444d668f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6d61696e7461696e65722d4073696c76696f6f6f73696c76612d626c75652e7376673f7374796c653d666f722d7468652d626164676526636f6c6f723d626c7565)](https://github.com/silviooosilva)[![Packagist Dependency Version](https://camo.githubusercontent.com/a71c6079c918992d8875763645200af37f6511374f0e354f234bbedead0e2afe/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f73696c76696f6f6f73696c76612f636163686565722d7068702f5048503f7374796c653d666f722d7468652d626164676526636f6c6f723d626c7565)](https://camo.githubusercontent.com/a71c6079c918992d8875763645200af37f6511374f0e354f234bbedead0e2afe/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f73696c76696f6f6f73696c76612f636163686565722d7068702f5048503f7374796c653d666f722d7468652d626164676526636f6c6f723d626c7565)[![Latest Version](https://camo.githubusercontent.com/1c8b47012d6200e83eb67467510184f811478746bbb33969199d5dadcbe524b4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f73696c76696f6f6f73696c76612f436163686565725048502e7376673f7374796c653d666f722d7468652d626164676526636f6c6f723d626c7565)](https://github.com/silviooosilva/CacheerPHP/releases)[![Quality Score](https://camo.githubusercontent.com/184f676339ba6e74d370dcb89c20d7f9a16ae9797c56b2724f0d0858db44b9c5/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f73696c76696f6f6f73696c76612f436163686565725048502e7376673f7374796c653d666f722d7468652d626164676526636f6c6f723d626c7565)](https://scrutinizer-ci.com/g/silviooosilva/CacheerPHP)[![Packagist Downloads](https://camo.githubusercontent.com/3ae20a2734a99917d110bb3ac62f7ef815ec7ba15c82410cb81be494037c058a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73696c76696f6f6f73696c76612f636163686565722d7068703f7374796c653d666f722d7468652d626164676526636f6c6f723d626c7565)](https://camo.githubusercontent.com/3ae20a2734a99917d110bb3ac62f7ef815ec7ba15c82410cb81be494037c058a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73696c76696f6f6f73696c76612f636163686565722d7068703f7374796c653d666f722d7468652d626164676526636f6c6f723d626c7565)

CacheerPHP is a minimalist PHP caching library with multiple backends (file, database, Redis and array), optional compression/encryption and a small but complete API.

Features
--------

[](#features)

- Multiple storage drivers: file system, databases (MySQL, PostgreSQL, SQLite), Redis and in-memory arrays.
- TTL, namespaces and tags for organization and invalidation.
- Auto-flush support with `flushAfter`.
- Optional compression and encryption.
- Formatter helper for JSON/array/object output.

Requirements
------------

[](#requirements)

- PHP 8.0+
- PDO drivers for database backends
- Redis server when using the Redis driver

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

[](#installation)

```
composer require silviooosilva/cacheer-php
```

Configuration
-------------

[](#configuration)

Copy the example environment file and adjust as needed:

```
cp .env.example .env
```

Minimum variables:

```
DB_CONNECTION=sqlite
REDIS_HOST=127.0.0.1
REDIS_PORT=6379
```

For MySQL/PostgreSQL:

```
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=cacheer_db
DB_USERNAME=root
DB_PASSWORD=secret
```

Quick start
-----------

[](#quick-start)

```
require_once __DIR__ . '/vendor/autoload.php';

use Silviooosilva\CacheerPhp\Cacheer;

Cacheer::setConfig()->setTimeZone('UTC');
Cacheer::setDriver()->useArrayDriver();

Cacheer::putCache('user:1', ['id' => 1, 'name' => 'John']);
if (Cacheer::has('user:1')) {
    $user = Cacheer::getCache('user:1');
}
```

File driver with options:

```
$cache = new Cacheer([
    'cacheDir' => __DIR__ . '/cache',
    'loggerPath' => __DIR__ . '/cacheer.log',
    'expirationTime' => '1 hour',
    'flushAfter' => '1 day',
]);
```

Drivers
-------

[](#drivers)

```
Cacheer::setDriver()->useFileDriver();
Cacheer::setDriver()->useDatabaseDriver();
Cacheer::setDriver()->useRedisDriver();
Cacheer::setDriver()->useArrayDriver();
```

Return contract
---------------

[](#return-contract)

- `putCache`, `appendCache`, `clearCache`, `flushCache`, `renewCache`, `putMany`, `tag`, `flushTag` return `bool`.
- `has` returns `bool`.
- `getCache` returns `mixed|null` (or `CacheDataFormatter` when formatter is enabled).
- `getMany` returns `array` (or `CacheDataFormatter` when formatter is enabled).
- `getAll` returns `array` (or `CacheDataFormatter` when formatter is enabled).
- `getMessage` returns `string`; `isSuccess` returns `bool`.

Formatter usage:

```
$cache->useFormatter();
$json = $cache->getCache('user:1')->toJson();
```

Testing
-------

[](#testing)

```
vendor/bin/phpunit
```

Documentation
-------------

[](#documentation)

Full documentation is available at [CacheerPHP Documentation](https://github.com/CacheerPHP/docs).

Contributing
------------

[](#contributing)

Contributions are welcome. Please open an issue or submit a pull request.

License
-------

[](#license)

CacheerPHP is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).

Support
-------

[](#support)

If this project helps you, consider [buying the maintainer a coffee](https://buymeacoffee.com/silviooosilva).

[ ![silviooosilva](https://camo.githubusercontent.com/0cf29a542375e1a46e84d8bf5805a4e5c0a6ee98b6547ccdc0c55eed49d99c69/68747470733a2f2f63646e2e6275796d6561636f666665652e636f6d2f627574746f6e732f76322f64656661756c742d79656c6c6f772e706e67)](https://buymeacoffee.com/silviooosilva)

###  Health Score

47

—

FairBetter than 94% of packages

Maintenance88

Actively maintained with recent releases

Popularity21

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

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

Recently: every ~37 days

Total

52

Last Release

77d ago

Major Versions

v1.5.0 → v2.0.02024-11-15

v2.3.1 → v3.0.02025-03-08

v3.7.0 → v4.0.02025-07-16

### Community

Maintainers

![](https://www.gravatar.com/avatar/acafabb3f98c3e7db56fccf9461fc7085d247c8ff23c177e3eb1182d2f9bcfbe?d=identicon)[silviooosilva](/maintainers/silviooosilva)

---

Top Contributors

[![silviooosilva](https://avatars.githubusercontent.com/u/66147538?v=4)](https://github.com/silviooosilva "silviooosilva (307 commits)")

---

Tags

phpdatabaseperformancemysqlsqlitepgsqlrediscachecachingnosqlpredisoptimizationfile cachespeedoptimizercache managerSilviooosilvadatabase-cache

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/silviooosilva-cacheer-php/health.svg)

```
[![Health](https://phpackages.com/badges/silviooosilva-cacheer-php/health.svg)](https://phpackages.com/packages/silviooosilva-cacheer-php)
```

###  Alternatives

[apix/cache

A thin PSR-6 cache wrapper with a generic interface to various caching backends emphasising cache taggging and indexing to Redis, Memcached, PDO/SQL, APC and other adapters.

114542.8k6](/packages/apix-cache)[matthiasmullie/scrapbook

Scrapbook is a PHP cache library, with adapters for e.g. Memcached, Redis, Couchbase, APCu, SQL and additional capabilities (e.g. transactions, stampede protection) built on top.

3212.5M32](/packages/matthiasmullie-scrapbook)[spiritix/lada-cache

A Redis based, automated and scalable database caching layer for Laravel

591444.8k2](/packages/spiritix-lada-cache)[vcian/laravel-db-auditor

Database DB Auditor provide leverage to audit your MySql,sqlite, PostgreSQL database standards and also provide options to add constraints in table.

28535.1k1](/packages/vcian-laravel-db-auditor)[ymigval/laravel-model-cache

Laravel package for caching Eloquent model queries

7642.2k3](/packages/ymigval-laravel-model-cache)[sarfraznawaz2005/indexer

Laravel package to monitor SELECT queries and offer best possible INDEX fields.

562.7k](/packages/sarfraznawaz2005-indexer)

PHPackages © 2026

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