PHPackages                             klimis/cachemiddleware - 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. klimis/cachemiddleware

ActiveLibrary[Caching](/categories/caching)

klimis/cachemiddleware
======================

Cache Laravel controllers' response

3.1.8(2mo ago)0553MITPHP

Since Feb 3Pushed 2mo ago1 watchersCompare

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

READMEChangelogDependencies (3)Versions (44)Used By (0)

### Cache Middleware

[](#cache-middleware)

##### (For Laravel Controllers)

[](#for-laravel-controllers)

[![Build Status](https://camo.githubusercontent.com/79b26ac6e4b40d5ffa5f084c9e839e6c26fa1210ae6be7f2391a62885ea5a77c/68747470733a2f2f7472617669732d63692e6f72672f6b6c696d69732f63616368652d6d6964646c65776172652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/klimis/cache-middleware)[![Generic badge](https://camo.githubusercontent.com/ced549d6bf1a4dcc973fb734d992d976bfcc192417ce6c69e3526049bedaa50e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f737461626c652d312e302e392d253343434f4c4f522533452e737667)](https://github.com/klimis/cache-middleware/tree/1.0.9)[![Generic badge](https://camo.githubusercontent.com/089e2fc69e55f5f0790402c0a09503ab7280a214b8fc6d2e651bdc9e8a5c152f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e63652d4d49542d42524f574e2e737667)](https://opensource.org/licenses/MIT)

#### Installation

[](#installation)

Composer:

1. `"klimis/cachemiddleware": "^1.0"`
2. Register in Kernel.php. Eg `'cache' => \Klimis\CacheMiddleware\Middleware\CacheMiddleware::class`

#### Usage

[](#usage)

- Set methods to be cached in Controllers. Add to any controller `public $cache = ['getPage'];` to cache forever or `public  $cache = ['getPage' => 60] ;` for cache with timeout
- Use header `Api-Disable-Cache = 1` to force disable cache for request
- Check response header `X-Is-From-Coin-Cache` to check if response is coming from cache
- Set env `DISABLE_CACHE` to true to disable all cache
- 1.3.1
- Added cacheExceptions eg ` public $cacheExceptions = [ 'getPage' => [ "page_type" => ["data-hub-explorer","test"]    ] ];`. Works for page\_type only at the moment

##### TODO

[](#todo)

- Move controller methods to middleware.
- More Unit test
- Create job for cleaning cache
- Hash key

###  Health Score

47

—

FairBetter than 93% of packages

Maintenance86

Actively maintained with recent releases

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity70

Established project with proven stability

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

Recently: every ~2 days

Total

42

Last Release

68d ago

Major Versions

1.3.8 → 2.0.02022-04-13

2.0.3 → 3.0.02026-01-13

### Community

Maintainers

![](https://www.gravatar.com/avatar/9d00e27d6df8fb0ea244b646b04bfc4cabc1ecd453869b664dd8a050bbc48451?d=identicon)[klimis](/maintainers/klimis)

---

Top Contributors

[![klimis](https://avatars.githubusercontent.com/u/1114156?v=4)](https://github.com/klimis "klimis (34 commits)")

---

Tags

cachelaravel

### Embed Badge

![Health badge](/badges/klimis-cachemiddleware/health.svg)

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

###  Alternatives

[iazaran/smart-cache

Smart Cache is a caching optimization package designed to enhance the way your Laravel application handles data caching. It intelligently manages large data sets by compressing, chunking, or applying other optimization strategies to keep your application performant and efficient.

21114.2k](/packages/iazaran-smart-cache)[phpfastcache/phpssdb

PHP SSDB Driver for phpFastCache

14736.9k1](/packages/phpfastcache-phpssdb)[rapidwebltd/rw-file-cache

RW File Cache is a PHP File-based Caching Library. Its syntax is designed to closely resemble the PHP memcache extension.

15196.8k7](/packages/rapidwebltd-rw-file-cache)[yuzuru-s/redis-recommend

Wrapping Redis's sorted set APIs for specializing recommending operations.

392.9k](/packages/yuzuru-s-redis-recommend)[ichhabrecht/intcache

Turn uncachable page objects into cacheable links

193.9k](/packages/ichhabrecht-intcache)

PHPackages © 2026

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