PHPackages                             swisnl/laravel-static-request-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. swisnl/laravel-static-request-cache

Abandoned → [silber/page-cache](/?search=silber%2Fpage-cache)ArchivedLibrary[Caching](/categories/caching)

swisnl/laravel-static-request-cache
===================================

Cache static responses based on content-type to static files.

1.5.0(3y ago)35.9k↑23.1%MITPHPPHP ^7.2|^8.0

Since Apr 20Pushed 3y ago2 watchersCompare

[ Source](https://github.com/swisnl/laravel-static-request-cache)[ Packagist](https://packagist.org/packages/swisnl/laravel-static-request-cache)[ Docs](https://github.com/swisnl/laravel-static-request-cache)[ RSS](/packages/swisnl-laravel-static-request-cache/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (5)Versions (16)Used By (0)

Laravel static request cache
============================

[](#laravel-static-request-cache)

[![Latest Version on Packagist](https://camo.githubusercontent.com/326319cba61b2210ae827ace9cd94a49a9595b70374dc1934293e724dbe6ba03/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f737769736e6c2f6c61726176656c2d7374617469632d726571756573742d63616368652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/swisnl/laravel-static-request-cache)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Buy us a tree](https://camo.githubusercontent.com/cec0a9b35a1c3235bdbe0d13ea8fbd866a23e30280ad6ca27078c1fd4ac1b709/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f54726565776172652d2546302539462538432542332d6c69676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://plant.treeware.earth/swisnl/laravel-static-request-cache)[![Build Status](https://camo.githubusercontent.com/aa156c1cfe03e0f40564522143446b3e791d68ad6042689a24bec0bca069a89d/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f737769736e6c2f6c61726176656c2d7374617469632d726571756573742d63616368652f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/swisnl/laravel-static-request-cache)[![Coverage Status](https://camo.githubusercontent.com/1f730fbb2964ad5532549316edfd8dde1aad82fa145bd4e2c826c0ca71932513/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f737769736e6c2f6c61726176656c2d7374617469632d726571756573742d63616368652e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/swisnl/laravel-static-request-cache/code-structure)[![Quality Score](https://camo.githubusercontent.com/2223aa957230fb42d756b68c6a892414ef938bc93f5ef5c5dbd5916ae20627c9/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f737769736e6c2f6c61726176656c2d7374617469632d726571756573742d63616368652e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/swisnl/laravel-static-request-cache)[![Total Downloads](https://camo.githubusercontent.com/7a2b6675f09de19254f3f0f6b9b4601d97829c39400b8d07cc86a7c0381ed2d9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f737769736e6c2f6c61726176656c2d7374617469632d726571756573742d63616368652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/swisnl/laravel-static-request-cache)[![Made by SWIS](https://camo.githubusercontent.com/ef6bdd6ab8d4f47bceb74dcf558b0915c6b419cbba320096324af0518e43091d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f2546302539462539412538302d6d6164652532306279253230535749532d2532333037333741392e7376673f7374796c653d666c61742d737175617265)](https://www.swis.nl)

🚨 **THIS PACKAGE HAS BEEN ABANDONED** 🚨

We don't use this package anymore in our own projects — we switched to Nginx with FastCGI Caching — and cannot justify the time needed to maintain it anymore. That's why we have chosen to abandon it. Feel free to fork our code and maintain your own copy or use one of the many alternatives. We suggest using [silber/page-cache](https://github.com/JosephSilber/page-cache) instead as it is fairly similar.

Install
-------

[](#install)

Via Composer

```
$ composer require swisnl/laravel-static-request-cache
```

Setup
-----

[](#setup)

Add the middleware to the end of your `Http/Kernel.php` middleware array.

```
protected $middleware = [
   \Swis\Laravel\StaticRequestCache\Http\Middleware\CacheMiddleware::class,
];
```

Add the following snippet into your `.htaccess`

```
# Rewrite to html cache if it exists and the request is for a static page
# (no url query params and only get requests)
RewriteCond %{REQUEST_METHOD} GET
RewriteCond %{QUERY_STRING} !.*=.*
RewriteCond %{DOCUMENT_ROOT}/static/html%{REQUEST_URI} -f
RewriteRule ^(.*)$  /static/html%{REQUEST_URI} [L]

RewriteCond %{REQUEST_METHOD} GET
RewriteCond %{QUERY_STRING} !.*=.*
RewriteCond %{REQUEST_URI} !index.php
RewriteCond %{DOCUMENT_ROOT}/static/html%{REQUEST_URI}/index.html -f
RewriteRule ^(.*)$ /static/html%{REQUEST_URI}/index.html [L]

```

Disabling
---------

[](#disabling)

If you want to disable the cache for some reason (the content might be dynamic), you can use the StaticRequestCache singleton in the IoC:

```
public function __construct(StaticRequestCache $staticRequestCache)
{
    $this->staticRequestCache = $staticRequestCache;
    $this->staticRequestCache->disable();
}
```

Or use the Facade:

```
StaticRequestCache::disable();
```

Please note that this package also checks for Cache-control headers and caches accordingly. You can change this behaviour in the config by editing `non_cacheable_cache_control_values`.

Clear the files
---------------

[](#clear-the-files)

To clear all the files manually you can use an artisan command.

```
$ php artisan static-html-cache:clear
```

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CODE\_OF\_CONDUCT](CODE_OF_CONDUCT.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

Based on [mscharl/laravel-static-html-cache](https://github.com/mscharl/laravel-static-html-cache). Added configuration for setting cacheable content-type and non-cacheable cache control values.

- [Björn Brala](https://github.com/bbrala)
- [Jasper Zonneveld](https://github.com/JaZo)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

This package is [Treeware](https://treeware.earth). If you use it in production, then we ask that you [**buy the world a tree**](https://plant.treeware.earth/swisnl/laravel-static-request-cache) to thank us for our work. By contributing to the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats.

SWIS ❤️ Open Source
-------------------

[](#swis-heart-open-source)

[SWIS](https://www.swis.nl) is a web agency from Leiden, the Netherlands. We love working with open source software.

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity76

Established project with proven stability

 Bus Factor1

Top contributor holds 93.5% 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 ~126 days

Recently: every ~281 days

Total

15

Last Release

1233d ago

Major Versions

0.7.0 → 1.0.02019-10-07

PHP version history (3 changes)0.1.0PHP &gt;=7.0

0.6.0PHP &gt;=7.1.3

1.4.0PHP ^7.2|^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8734305?v=4)[SWIS](/maintainers/swisnl)[@swisnl](https://github.com/swisnl)

---

Top Contributors

[![JaZo](https://avatars.githubusercontent.com/u/3475007?v=4)](https://github.com/JaZo "JaZo (72 commits)")[![HendrikN](https://avatars.githubusercontent.com/u/850404?v=4)](https://github.com/HendrikN "HendrikN (3 commits)")[![bbrala](https://avatars.githubusercontent.com/u/3294970?v=4)](https://github.com/bbrala "bbrala (1 commits)")[![PrinsFrank](https://avatars.githubusercontent.com/u/25006490?v=4)](https://github.com/PrinsFrank "PrinsFrank (1 commits)")

---

Tags

hacktoberfestswisnllaravel-static-request-cache

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/swisnl-laravel-static-request-cache/health.svg)

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

###  Alternatives

[unopim/unopim

UnoPim Laravel PIM

10.5k2.4k](/packages/unopim-unopim)[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135224.7k7](/packages/statamic-rad-pack-runway)[api-platform/laravel

API Platform support for Laravel

58171.5k14](/packages/api-platform-laravel)[ecotone/laravel

Ecotone for Laravel — CQRS, Event Sourcing, Sagas, Durable Workflows, and Outbox on top of Laravel Queue, via PHP attributes.

21318.6k3](/packages/ecotone-laravel)[duncanmcclean/statamic-cargo

Comprehensive e-commerce addon for Statamic. Build bespoke e-commerce sites without the complexity.

3416.9k](/packages/duncanmcclean-statamic-cargo)[byerikas/cache-tags

Allows for Redis/Valkey cache flushing multiple tagged items by a single tag.

1420.4k](/packages/byerikas-cache-tags)

PHPackages © 2026

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