PHPackages                             rose1988c/laravel-routecache-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. rose1988c/laravel-routecache-middleware

ActiveLibrary[Caching](/categories/caching)

rose1988c/laravel-routecache-middleware
=======================================

Laravel Page Cache Use Middleware With Route

5.1(10y ago)027MITPHPPHP &gt;=5.5.0

Since Nov 13Pushed 9y ago1 watchersCompare

[ Source](https://github.com/SirionDev/laravel-middleware-routecache)[ Packagist](https://packagist.org/packages/rose1988c/laravel-routecache-middleware)[ Docs](https://github.com/rose1988c/laravel-routecache-middleware)[ RSS](/packages/rose1988c-laravel-routecache-middleware/feed)WikiDiscussions master Synced yesterday

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

Laravel 5 Page Cache Use Middleware
-----------------------------------

[](#laravel-5-page-cache-use-middleware)

Add page cache with route.

The cache is best not to write in the program logic inside, to find a cache is very tired, I suggest that the cache in the routing

缓存放在路由里面, 使用方法如下：

```
    Route::group(['middleware' => 'cache:10'], function(){
        Route::get('/', 'HomeController@index');
    });

```

\###Installation

Add to composer.json

```
"rose1988c/laravel-routecache-middleware":"dev-master"

or

composer require rose1988c/laravel-routecache-middleware:dev-master
```

Register the service provider by adding in the provider section in config/app.php

```
    'providers' => [
        ...
        Rose1988c\RouteCache\RouteCacheServiceProvider::class
        ...

```

Just in case

```
    composer dump-autoload

```

Publish the migration and the config file

```
    php artisan vendor:publish

```

Add to app\\Http\\Kernel.php

```
    'cache' => \Rose1988c\RouteCache\CacheMiddleWare::class,
    'flush' => \Rose1988c\RouteCache\FlushMiddleWare::class,

```

Setting Route.php

```
    // set cache lifetime 10
    Route::group(['middleware' => 'cache:10'], function(){
        Route::get('/', 'DemoController@index');
    });

```

Flush Cache

- flush -&gt; Flush Current Request Url
- flush:ref -&gt; Flush Referer Url, Often used in AJAX
- flush:url -&gt; Flush Appoint Url, Often used in Manage And Clean Appoint Url, Add arg `?flushurl=http://xxxxx`

```
    Route::group(['middleware' => 'flush'], function(){
        Route::any('switchP', 'HomeController@switchP');
    });

    Route::group(['middleware' => 'flush:ref'], function(){
        Route::any('switchP', 'HomeController@switchP');
    });

    // test url: http://192.168.141.129:8084/cleanCache?flushurl=http://192.168.141.129:8084/wealthbalance
    // result  : ok
    Route::group(['middleware' => 'flush:url'], function(){
        Route::any('cleanCache', function(){
            echo 'hello, world!';
        });
    });

```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

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

3833d ago

### Community

Maintainers

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

---

Tags

middlewarelaravelcacherose1988claravel-routecache-middleware

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/rose1988c-laravel-routecache-middleware/health.svg)

```
[![Health](https://phpackages.com/badges/rose1988c-laravel-routecache-middleware/health.svg)](https://phpackages.com/packages/rose1988c-laravel-routecache-middleware)
```

###  Alternatives

[spatie/laravel-responsecache

Speed up a Laravel application by caching the entire response

2.8k8.2M51](/packages/spatie-laravel-responsecache)[dragon-code/laravel-cache

An improved interface for working with cache

6844.8k10](/packages/dragon-code-laravel-cache)[nexxai/laravel-cfcache

A handful of Cloudflare cache helpers for Laravel

1317.7k](/packages/nexxai-laravel-cfcache)[omaralalwi/lexi-translate

Laravel translation package with morph relationships and caching.

754.3k2](/packages/omaralalwi-lexi-translate)[michele-angioni/support

Support is a Laravel package which promotes the use of best practices and design patterns.

181.4k1](/packages/michele-angioni-support)[makbulut/laravel-aerospike

Aerospike cache driver for Laravel

102.2k](/packages/makbulut-laravel-aerospike)

PHPackages © 2026

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