PHPackages                             lmammino/guzzle-fs-cache-middleware - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. lmammino/guzzle-fs-cache-middleware

ActiveLibrary[HTTP &amp; Networking](/categories/http)

lmammino/guzzle-fs-cache-middleware
===================================

A minimalist and opinionated Cache Middleware for Guzzle that uses the FileSystem as backend

1.0.0(6y ago)13MITPHPPHP &gt;=5.6

Since Mar 31Pushed 6y ago1 watchersCompare

[ Source](https://github.com/lmammino/guzzle-fs-cache-middleware)[ Packagist](https://packagist.org/packages/lmammino/guzzle-fs-cache-middleware)[ RSS](/packages/lmammino-guzzle-fs-cache-middleware/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (2)Versions (2)Used By (0)

guzzle-fs-cache-middleware
==========================

[](#guzzle-fs-cache-middleware)

A minimalist and opinionated Cache Middleware for Guzzle that uses the FileSystem as backend (compatible with PHP 5.6+).

Install
-------

[](#install)

Using composer:

```
composer require lmammino/guzzle-fs-cache-middleware
```

Usage
-----

[](#usage)

Create an instance of `LM\Guzzle\FS\CacheMiddleware` and add it to your middleware stack:

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

use GuzzleHttp\HandlerStack;
use GuzzleHttp\Handler\CurlHandler;
use GuzzleHttp\Client;
use LM\Guzzle\FS\CacheMiddleware;

$cacheDir = __DIR__.'/cache/';
$namespace = 'api_client';
$ttl = 60;
$cacheMiddleware = new CacheMiddleware($cacheDir, $namespace, $ttl);

$stack = new HandlerStack();
$stack->setHandler(new CurlHandler());
$stack->push($cacheMiddleware);
$client = new Client(['handler' => $stack]);

$res = $client->request('GET', $argv[1]);
$headers = $res->getHeaders();
foreach ($headers as  $k => $h) {
    foreach ($h as $v) {
        echo $k . ": " . $v . "\n";
    }
}
echo "\n\n" . $res->getBody()->__toString() . "\n\n";
```

`CacheMiddleware` accepts a cache directory, an optional namespace (defaults to `default`) and an optiona ttl in seconds (defaults to `60`).

**Note**: this middleware will always respect the TTL you provide and will ignore any HTTP cache header returned as response. This is by design. Use this middleware only if you want to enforce cache or for micro-caching scenarios (e.g. very expensive and frequent API calls).

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

[](#contributing)

Everyone is very welcome to contribute to this project. You can contribute just by submitting bugs or suggesting improvements by [opening an issue on GitHub](https://github.com/lmammino/guzzle-fs-cache-middleware/issues).

License
-------

[](#license)

Licensed under [MIT License](LICENSE). © Luciano Mammino.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

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

2233d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/205629?v=4)[Luciano Mammino](/maintainers/lmammino)[@lmammino](https://github.com/lmammino)

---

Top Contributors

[![lmammino](https://avatars.githubusercontent.com/u/205629?v=4)](https://github.com/lmammino "lmammino (3 commits)")

---

Tags

cachefilesystemguzzlehttphttpclientfilesystemhttp clientGuzzlecache

### Embed Badge

![Health badge](/badges/lmammino-guzzle-fs-cache-middleware/health.svg)

```
[![Health](https://phpackages.com/badges/lmammino-guzzle-fs-cache-middleware/health.svg)](https://phpackages.com/packages/lmammino-guzzle-fs-cache-middleware)
```

###  Alternatives

[e-moe/guzzle6-bundle

Integrates Guzzle 6 into your Symfony application

11259.2k](/packages/e-moe-guzzle6-bundle)[amphp/http-client-guzzle-adapter

Guzzle adapter for Amp's HTTP client.

1523.6k1](/packages/amphp-http-client-guzzle-adapter)[opgg/riotquest

RiotQuest, PHP RiotAPI client library that focused on multi request from OP.GG

172.6k](/packages/opgg-riotquest)

PHPackages © 2026

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