PHPackages                             stounhandj/laravel-cache-route - 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. stounhandj/laravel-cache-route

ActiveLibrary[Caching](/categories/caching)

stounhandj/laravel-cache-route
==============================

Cache (HTML) output of entire route to speedup your Laravel application

v1.1.3(4y ago)0223MITPHPPHP ^7.2 || ^8.0

Since May 26Pushed 4y agoCompare

[ Source](https://github.com/StounhandJ/laravel-cache-route)[ Packagist](https://packagist.org/packages/stounhandj/laravel-cache-route)[ RSS](/packages/stounhandj-laravel-cache-route/feed)WikiDiscussions master Synced yesterday

READMEChangelog (2)Dependencies (4)Versions (5)Used By (0)

Cache contents of entire route in Laravel
=========================================

[](#cache-contents-of-entire-route-in-laravel)

[![Total Downloads](https://camo.githubusercontent.com/b7cfe51dad2c609aebc62ad1774f8802ca878052f33b6f6f039333ae61797666/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73746f756e68616e646a2f6c61726176656c2d63616368652d726f757465)](https://packagist.org/packages/stounhandj/laravel-cache-route)[![Latest Stable Version](https://camo.githubusercontent.com/e1a226762612adcee0b471bef4ea8ac2aa608304c9f2a43f0fff8a2e523e4f05/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73746f756e68616e646a2f6c61726176656c2d63616368652d726f757465)](https://packagist.org/packages/stounhandj/laravel-cache-route)[![License](https://camo.githubusercontent.com/2f2fbb845f1352ee503b690badfa1567ef7fc0b8a4abf6f7fc42f358e090bf76/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f73746f756e68616e646a2f6c61726176656c2d63616368652d726f757465)](https://packagist.org/packages/stounhandj/laravel-cache-route)

This is the Laravel 7.0+ / PHP 7.2+ package, which provides the ability to cache routes for the allotted time. Installation
------------

[](#installation)

```
$ composer require stounhandj/laravel-cache-route

```

Or

```
{
    "require": {
        "stounhandj/laravel-cache-route": "^v1.1"
    }
}
```

Usage
-----

[](#usage)

Add middleware to the file kernel.php:

```
'cache.page' => \StounhandJ\LaravelCacheRoute\Middleware\CacheRoteMiddleware::class,
```

Now, use the middleware to cache the HTML output of an entire page from your route like so:

1. In your route:

    ```
    Route::get('/', function () {
         //
    })->middleware("cache.page")
    ```

    You may also use route groups. Please look up Laravel documentation on Middleware to learn more [here](https://laravel.com/docs/7.x/middleware)

Configuration Options
---------------------

[](#configuration-options)

You can configure the TTL (Time-To-Live) to cast per second:

1. In your route: ```
    Route::get('/', function () {
         //
    })->middleware("cache.page:10")
    ```
2. Environment (On all routes at once): ```
    CACHE_TTL=10
    ```

Thoughts
--------

[](#thoughts)

Be VERY cautions when using a whole page cache such as this. Remember contents of the cache are visible to ALL your users.

1. For, "mostly static" content, go for it!
2. For, "mostly dynamic" content or heavily user-customized content, AVOID this strategy. User specific information is gathered server side. So, you essentially WANT to hit the server.

**Good rule of thumb**: If two different users see different pages on hitting the same URL, DO NOT cache the output using this strategy. An alternative may be to cache database queries.

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 70% 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 ~619 days

Total

4

Last Release

1468d ago

PHP version history (2 changes)v1.0PHP &gt;=5.4.0

v1.1PHP ^7.2 || ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/8a56d387ac565d0b8c58a250620cd5282b6a88035a1eedfb0001ced526dcd49d?d=identicon)[StounhandJ](/maintainers/StounhandJ)

---

Top Contributors

[![StounhandJ](https://avatars.githubusercontent.com/u/58305548?v=4)](https://github.com/StounhandJ "StounhandJ (7 commits)")[![mnshankar](https://avatars.githubusercontent.com/u/2873887?v=4)](https://github.com/mnshankar "mnshankar (3 commits)")

### Embed Badge

![Health badge](/badges/stounhandj-laravel-cache-route/health.svg)

```
[![Health](https://phpackages.com/badges/stounhandj-laravel-cache-route/health.svg)](https://phpackages.com/packages/stounhandj-laravel-cache-route)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[api-platform/laravel

API Platform support for Laravel

58171.6k14](/packages/api-platform-laravel)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

77022.3M151](/packages/laravel-mcp)[illuminate/auth

The Illuminate Auth package.

10528.2M1.2k](/packages/illuminate-auth)[defstudio/telegraph

A laravel facade to interact with Telegram Bots

816333.8k3](/packages/defstudio-telegraph)[illuminate/routing

The Illuminate Routing package.

1419.2M3.0k](/packages/illuminate-routing)

PHPackages © 2026

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