jeffersongoncalves/laravel-page-cache
Laravel Page Cache adds simple full-page HTTP caching to Laravel apps, storing rendered responses and serving them quickly to reduce database load and speed up page delivery. Includes middleware and cache-clearing helpers.
Install the package with Composer, publish its config if the package exposes one, and register the page-cache middleware on the routes or middleware group you want cached. Start with a small, public, guest-only page such as a marketing or docs route.
Look first at:
First use case: cache a public GET page for guests, confirm a MISS then HIT via response headers or logs, and verify that authenticated or personalized pages are not cached.
For v1.3.0 specifically: if you use Vite::cspNonce() with laravel-security-headers 2.1+, add a quick smoke test that a cached page still loads its inline scripts under the CSP header. Apps without a CSP nonce need no change.
web route group. Avoid caching the entire application until exclusions are proven.Auth::check() or a custom cache bypass rule.HIT.laravel-security-headers 2.1+, ensure the page-cache middleware runs before the middleware that builds the CSP header. On a HIT, v1.3.0 restores the nonce that was present in the cached HTML so the later CSP header matches the cached inline scripts.Vite::cspNonce() normally in Blade. The package preserves the rendered nonce in the cached response; do not manually strip or rewrite nonces in cached markup.MISS then HIT, guest vs. authenticated responses, excluded routes, and — if CSP is enabled — that cached HTML nonces match the emitted CSP header.Vite::cspNonce() or without a CSP nonce need no migration. The release is additive; no breaking changes are indicated.Set-Cookie or other per-request headers if not handled. Verify your cache profile strips or ignores them.utm_*.Content-Security-Policy header, and confirm middleware order. Clear the cache after changing CSP or Vite configuration.HIT/MISS. These are the safest places to adapt behavior without forking the middleware.How can I help you explore Laravel packages today?