PHPackages                             dburiy/filecacher - 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. dburiy/filecacher

ActiveLibrary[Caching](/categories/caching)

dburiy/filecacher
=================

Simple php file cacher

1.1.0(4y ago)121703MITPHPPHP ^7.2

Since Apr 11Pushed 4y ago1 watchersCompare

[ Source](https://github.com/dburiy/filecacher)[ Packagist](https://packagist.org/packages/dburiy/filecacher)[ RSS](/packages/dburiy-filecacher/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (7)Dependencies (2)Versions (9)Used By (0)

FileCacher class
================

[](#filecacher-class)

[![Total Downloads](https://camo.githubusercontent.com/2bc2a0b5b0d01eabab07b6d40d90b8a74ea00c553568f1ff3346ed4a85a48920/68747470733a2f2f706f7365722e707567782e6f72672f6462757269792f66696c656361636865722f642f746f74616c2e706e67)](https://packagist.org/packages/dburiy/filecacher/stats)[![License: MIT](https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667)](https://opensource.org/licenses/MIT)[![visitor badge](https://camo.githubusercontent.com/c47469ef81222a6853633e910a72c118b81cdd17602c8c91dad73cf3f4e837e0/68747470733a2f2f76697369746f722d62616467652e676c697463682e6d652f62616467653f706167655f69643d6462757269792e66696c65636163686572)](https://camo.githubusercontent.com/c47469ef81222a6853633e910a72c118b81cdd17602c8c91dad73cf3f4e837e0/68747470733a2f2f76697369746f722d62616467652e676c697463682e6d652f62616467653f706167655f69643d6462757269792e66696c65636163686572)

Install
-------

[](#install)

The recommended way to install this package is through Composer:

```
$ composer require dburiy/filecacher

```

How to use
----------

[](#how-to-use)

#### Init

[](#init)

```
$cacher_dir = __DIR__ . '/cacher';
$cacher = new \Dburiy\FileCacher($cacher_dir);

```

#### Store data

[](#store-data)

```
$lifetime = 10; // time in second
$data = "some string";
$cacher->set("storage_strings_str1", $data, $lifetime);

# Result:
# Will be created file in cache dir: `[dir]/storage/strings/str1`
# with data: `some string`

```

#### Get data

[](#get-data)

```
$default = "some default value";
$callback = function (){
    return time();
};

# if cache not found or expire
$cacher->get("key");            # return null
$cacher->get("key", $default);  # return string "some default value"
$cacher->get("key", $callback); # return timestamp

```

#### Remove data

[](#remove-data)

```
$cacher->delete("key");

```

With PSR
--------

[](#with-psr)

```
use Dburiy\FileCacher;
use Dburiy\PsrBridge\FileCacher as PsrCacher;

include __DIR__ . '/../vendor/autoload.php';

$cacher = new PsrCacher(new FileCacher(__DIR__ . '/cache'));

$item = $cacher
    ->getItem('test')
    ->expiresAfter(DateInterval::createFromDateString('1 min'))
//    ->expiresAfter(10) // seconds
//    ->expiresAt(new DateTime('2022-01-29T13:02:00', new DateTimeZone('europe/moscow')))
    ->set(['value' => time()])
;
$cacher->save($item);
//$cacher->saveDeferred($item);
//$cacher->commit();

var_dump($item->get());

if (!$item->isHit()) {
    $cacher->deleteItem('test');
}

```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 87% 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 ~146 days

Recently: every ~199 days

Total

8

Last Release

1565d ago

PHP version history (2 changes)1.0.0PHP ^7.0

1.0.4PHP ^7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/031f48b250f85b441a6ba3ab46d7d18f1a25f9b3fe45cce68092de647ddff537?d=identicon)[dburiy](/maintainers/dburiy)

---

Top Contributors

[![dburiy](https://avatars.githubusercontent.com/u/1164631?v=4)](https://github.com/dburiy "dburiy (20 commits)")[![mrunkel](https://avatars.githubusercontent.com/u/3205232?v=4)](https://github.com/mrunkel "mrunkel (3 commits)")

###  Code Quality

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/dburiy-filecacher/health.svg)

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

###  Alternatives

[symfony/cache

Provides extended PSR-6, PSR-16 (and tags) implementations

4.2k348.9M2.5k](/packages/symfony-cache)[symfony/cache-contracts

Generic abstractions related to caching

2.4k308.9M198](/packages/symfony-cache-contracts)[tedivm/stash

The place to keep your cache.

9824.8M124](/packages/tedivm-stash)[league/flysystem-cached-adapter

An adapter decorator to enable meta-data caching.

35426.9M119](/packages/league-flysystem-cached-adapter)[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/adapter-common

Common classes for PSR-6 adapters

11124.4M38](/packages/cache-adapter-common)

PHPackages © 2026

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