PHPackages                             biohzrdmx/cacher-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. [Caching](/categories/caching)
4. /
5. biohzrdmx/cacher-php

ActiveLibrary[Caching](/categories/caching)

biohzrdmx/cacher-php
====================

A simple, general-purpose, file-based cache provider

2.0(5y ago)182MITPHPPHP &gt;=5.6

Since Mar 31Pushed 5y ago1 watchersCompare

[ Source](https://github.com/biohzrdmx/cacher-php)[ Packagist](https://packagist.org/packages/biohzrdmx/cacher-php)[ RSS](/packages/biohzrdmx-cacher-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

cacher-php
==========

[](#cacher-php)

A simple, general-purpose, file-based cache provider

### Basic usage

[](#basic-usage)

First require `biohzrdmx/cacher-php` with Composer.

Now create a `Cacher` instance passing the cache directory and optionally, the caching time:

```
$cacher = new Cacher(dirname(__FILE__) . '/cache');
```

Once you've created the instance you may start manipulating the cache items, for example, by adding a new item:

```
$cacher->store('results', $results);
```

The next time you need to use the `results` data, just recover them from the cache. The first thing to do is check if it exists and if it's still fresh:

```
$cacher->isCached('results');
```

The `isCached` method will return `true` if the data is in the cache and is fresh enough. Once you've checked it, recover its contents:

```
$results = $cacher->retrieve('results');
```

And that's it. Easy peasy.

Usually all those operations are executed in the following form:

```
use Cacher\Cacher;

$cacher = new Cacher(BASE_DIR . '/cache');

if ( $cacher->isCached('results') ) {
  $results = $cacher->retrieve('results');
} else {
  $results = fetchResultsFromSomeSource();
  $cacher->store('results', $results);
}
```

You may also specify a serialize and unserialize callback with the `setSerializer($serializer)` and `setUnserializer($unserializer)` methods.

Finally if you want to delete a cached item you may do so with the `delete($name)` function.

### Licensing

[](#licensing)

This software is released under the MIT license.

Copyright © 2021 biohzrdmx

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

### Credits

[](#credits)

**Lead coder:** biohzrdmx [github.com/biohzrdmx](http://github.com/biohzrdmx)

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity47

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

Unknown

Total

1

Last Release

1865d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/44b968bb45d47a621ce8e81c422ef4c126316a702156a7faf96df75610cc0d45?d=identicon)[biohzrdmx](/maintainers/biohzrdmx)

---

Top Contributors

[![biohzrdmx](https://avatars.githubusercontent.com/u/2053303?v=4)](https://github.com/biohzrdmx "biohzrdmx (6 commits)")

---

Tags

cachefile-cachephp

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/biohzrdmx-cacher-php/health.svg)

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

###  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)
