Install
composer require cuatao/laravel-html-caching
Publish the package config file
php artisan vendor:publish
Register as route middleware
// within app/Http/Kernel.php
protected $routeMiddleware = [
//
\Cuatao\LaravelHtmlCaching\Http\Middleware\ResponseHtmlCachingBeforeMiddleware::class,
\Cuatao\LaravelHtmlCaching\Http\Middleware\ResponseHtmlCachingAfterMiddleware::class,
//
];
Apply HTML response cache to routes
// within routes/web.php
Route::get('/', function () {
return view('welcome');
})->middleware('web');