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

ActiveLibrary[Caching](/categories/caching)

ipunkt/laravel-route-cache
==========================

Simple Cache for Laravel Routes sending 304 and cached static content

1.0.3(11y ago)5901MITPHPPHP &gt;=5.4.0

Since Jul 25Pushed 11y ago4 watchersCompare

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

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

Route Cache for Laravel 4.x
===========================

[](#route-cache-for-laravel-4x)

[![Latest Stable Version](https://camo.githubusercontent.com/090f78088c9189f7d0cc3a44302c9f7772a1353fab435851951dafc86db4d14f/68747470733a2f2f706f7365722e707567782e6f72672f6970756e6b742f6c61726176656c2d726f7574652d63616368652f762f737461626c652e737667)](https://packagist.org/packages/ipunkt/laravel-route-cache) [![Latest Unstable Version](https://camo.githubusercontent.com/44c85bb5038789e18698d799379ba8751589983e0ad85d9fc2974bbd6c775674/68747470733a2f2f706f7365722e707567782e6f72672f6970756e6b742f6c61726176656c2d726f7574652d63616368652f762f756e737461626c652e737667)](https://packagist.org/packages/ipunkt/laravel-route-cache) [![License](https://camo.githubusercontent.com/319d541798a1754b365f9c577a95982dbd393105e5edff3591e45c8e3ceff5c6/68747470733a2f2f706f7365722e707567782e6f72672f6970756e6b742f6c61726176656c2d726f7574652d63616368652f6c6963656e73652e737667)](https://packagist.org/packages/ipunkt/laravel-route-cache) [![Total Downloads](https://camo.githubusercontent.com/b2291234919ba2649041feb7bf4d581877d3a1ed8ee374f51b83ffbf08ed484b/68747470733a2f2f706f7365722e707567782e6f72672f6970756e6b742f6c61726176656c2d726f7574652d63616368652f646f776e6c6f6164732e737667)](https://packagist.org/packages/ipunkt/laravel-route-cache)

This package simplifies caching of static pages in your laravel project. It sends 304 status headers and (if available) static html without running the controller. The configuration ist easy and straight forward using a single route-filter.

Installation
------------

[](#installation)

Add to your composer.json following lines

```
"require": {
	"ipunkt/laravel-route-cache": "~1.0.0"
}

```

Run `php artisan config:publish ipunkt/laravel-route-cache`

Add `'Ipunkt\LaravelRouteCache\LaravelRouteCacheServiceProvider',` to `providers` in `app/config/app.php`.

Configuration
-------------

[](#configuration)

Edit `config.php` in `app/config/packages/ipunkt/laravel-route-cache` to your needs.

How to use as Laravel Route-Filter
----------------------------------

[](#how-to-use-as-laravel-route-filter)

Add `'before' => 'cache.before'` to every route you like to cache. **The route has to be canonical!**, because the filter caches just by extracting the `url()` from the Request. (maybe i change that to `fullUrl()`)

To outdate a cache, just fire the Event `entity.modified` and attach the Request or URL of the modified ressource. You can force that on your browser by attaching the GET-Parameter set in your config as `cachebuster` (default is "renew-cache") to the URL.

If the `infoheader` config setting is not `false` the library adds a Header to the Response to show wether the content came from cache or the controller.

Other usages
------------

[](#other-usages)

The class `Ipunkt\LaravelRouteCache\RouteCache` works out of the box without the filter. You can use it in your controllers

```
// get RouteCache-Instance
$routecache = \App::make('routecache');
$routecache->setEntityFromRequest($request);
// or
$routecache->setEntityFromUrl($url);

// to remove the cache
$routecache->removeCache()

// to check if the client has a valid (same ETag) Cache
$routecache->checkClientHasValidCache()

// to save a Response to the Cache
$routecache->setCacheFromResponse(Response $response)

// to save string-content to the Cache
$routecache->setCacheFromContent($content)

// to get a saved Response from the Cache
$routecache->getResponseFromCache()

// to get a saved string from the Cache
$routecache->getContentFromCache()

// you can get the ETag for the entity (but you don't need it)
$routecache->getETag()

// you can even set a custom ETag if you like
$routecache->getETag($value)

```

Open TODOs
----------

[](#open-todos)

Feel free to fork and push changes

- remember all cached entities and allow to clear them with a Command
- add TestCases
- cache content-type of the content and respond with that.
- Routines to handle POST, PUT, UPDATE and DELETE Requests

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity61

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

Total

4

Last Release

4306d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3680539?v=4)[Bastian Rang](/maintainers/justb81)[@justb81](https://github.com/justb81)

---

Top Contributors

[![justb81](https://avatars.githubusercontent.com/u/3680539?v=4)](https://github.com/justb81 "justb81 (13 commits)")

### Embed Badge

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

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

###  Alternatives

[spatie/laravel-responsecache

Speed up a Laravel application by caching the entire response

2.8k8.2M51](/packages/spatie-laravel-responsecache)[genealabs/laravel-model-caching

Automatic caching for Eloquent models.

2.4k4.8M26](/packages/genealabs-laravel-model-caching)[mikebronner/laravel-model-caching

Automatic caching for Eloquent models.

2.4k127.1k1](/packages/mikebronner-laravel-model-caching)[illuminate/cache

The Illuminate Cache package.

12835.6M1.4k](/packages/illuminate-cache)[laragear/cache-query

Remember your query results using only one method. Yes, only one.

272122.8k](/packages/laragear-cache-query)[namoshek/laravel-redis-sentinel

An extension of Laravels Redis driver which supports connecting to a Redis master through Redis Sentinel.

38679.0k](/packages/namoshek-laravel-redis-sentinel)

PHPackages © 2026

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