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 2w ago

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 35% 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

3883d 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.7M64](/packages/spatie-laravel-responsecache)[mongodb/laravel-mongodb

A MongoDB based Eloquent model and Query builder for Laravel

7.1k8.4M91](/packages/mongodb-laravel-mongodb)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k15.1M125](/packages/laravel-pulse)[propaganistas/laravel-disposable-email

Disposable email validator

6012.9M7](/packages/propaganistas-laravel-disposable-email)[harris21/laravel-fuse

Circuit breaker for Laravel queue jobs. Protect your workers from cascading failures.

43140.3k](/packages/harris21-laravel-fuse)[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.

2119.7k](/packages/iazaran-smart-cache)

PHPackages © 2026

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