Search by

nocache-dev / laravel

nocachedev

Correct Cache-Control headers for Laravel responses, plus artisan commands to check URLs and manage nocache.dev monitors.

v1.0.0 2026-10-20 10:58 UTC

This package is not auto-updated.

Last update: 2026-10-21 09:20:12 UTC


README

CDN-friendly Cache-Control for Laravel, and artisan commands for nocache.dev checks and monitors. Laravel 10–12, PHP 8.1+.

composer require nocache-dev/laravel
Route::middleware('nocache.headers')->group(function () {        // s-maxage=300
    Route::get('/', HomeController::class);
});
Route::get('/blog/{post}', ShowPost::class)->middleware('nocache.headers:900'); // s-maxage=900

Anonymous GET responses get public, max-age=0, s-maxage=300, stale-while-revalidate=60. Signed-in users and responses that set a cookie get private, no-cache. A Cache-Control you set yourself is kept.

php artisan nocache:check https://example.com --min-grade=B
NOCACHE_TOKEN=nc_... php artisan nocache:monitor https://example.com
php artisan nocache:monitor --list
php artisan vendor:publish --tag=nocache-config

Config: NOCACHE_TOKEN, NOCACHE_API, NOCACHE_MONITOR_URLS (comma-separated).