nocache-dev / laravel
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
Requires
- php: ^8.1
- illuminate/console: ^10.0|^11.0|^12.0
- illuminate/http: ^10.0|^11.0|^12.0
- illuminate/support: ^10.0|^11.0|^12.0
Requires (Dev)
- orchestra/testbench: ^8.0|^9.0|^10.0
- phpunit/phpunit: ^10.5|^11.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
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).