PHPackages                             geniussystems-np/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. [Caching](/categories/caching)
4. /
5. geniussystems-np/cache-middleware

ActiveLibrary[Caching](/categories/caching)

geniussystems-np/cache-middleware
=================================

Cache Middleware for Resources

1.0.1(5y ago)16.4k↓17.4%2[1 PRs](https://github.com/geniussystems-np/cache-middleware/pulls)MITPHP

Since Sep 29Pushed 5y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (3)Used By (0)

Cache Middleware for Laravel/Lumen
==================================

[](#cache-middleware-for-laravellumen)

We use two middleware for cache, one for serving response from cache and another for generating cache.

- ServeCachedResponse
    - The only job will be serve the response from cache if available
    - This middleware should be below the Authentication in the Middleware stack
- CacheReponse
    - This middleware should analyze the response for it’s cacheability by checking the cache headers
    - If the response is cacheable, it should cache the response in configured cache store(Redis)
    - Currently, We are using only `cache-control` directive to cache the response

The package uses Laravel `Cache` to store and serve response. Any response having `cache-control` directive with `max-age` will be cached for duration defined in max-age parameter.

Installing the package using composer
-------------------------------------

[](#installing-the-package-using-composer)

```
composer require geniussystems-np/cache-middleware

```

Once the package is installed, enable the Middleware in `app/Http/Kernel.php` and add to your required middleware group.

```
protected $middleware = [
        \App\Http\Middleware\TrustHosts::class,
        \App\Http\Middleware\TrustProxies::class,
        \Fruitcake\Cors\HandleCors::class,
        \App\Http\Middleware\PreventRequestsDuringMaintenance::class,
        \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
        \App\Http\Middleware\TrimStrings::class,
        \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
        .
        .
        \GeniusSystems\Http\Middleware\ServeCachedResponse::class,
        .
        .
        \GeniusSystems\Http\Middleware\CacheResponse::class,
  ];
```

`ServeCacheResponse` should be after authentication middleware since it doesn’t pass the request to other middleware in the stack if there’s a response. Above code asumes you’re enabling `cache-middleware` for all the routes. For specific routes, you need to added the middleware to it’s respective group and enable middleware in route.

###  Health Score

31

—

LowBetter than 65% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 83.3% 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 ~0 days

Total

2

Last Release

2149d ago

### Community

Maintainers

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

---

Top Contributors

[![bdryagya](https://avatars.githubusercontent.com/u/3938193?v=4)](https://github.com/bdryagya "bdryagya (5 commits)")[![jerryamatya](https://avatars.githubusercontent.com/u/13400753?v=4)](https://github.com/jerryamatya "jerryamatya (1 commits)")

### Embed Badge

![Health badge](/badges/geniussystems-np-cache-middleware/health.svg)

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

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