PHP code example of label-li / laravel-page-cache

1. Go to this page and download the library: Download label-li/laravel-page-cache library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

label-li / laravel-page-cache example snippets


php artisan vendor:publish --provider="LabelLi\LaravelPageCache\PageCacheServiceProvider"

protected $middlewareGroups = [
    'web' => [
        \LabelLi\LaravelPageCache\Middleware\CacheResponse::class,
        ...
    ],
];

protected $routeMiddleware = [
    'page-cache' => \LabelLi\LaravelPageCache\Middleware\CacheResponse::class,
    ...
];

'CacheTime' => 3600, // In seconds
'CachePath' => 'pagecache', // In storage

Route::middleware('page-cache')->get('/page', 'PageController@show');

php artisan PageCache:clear

php artisan PageCache:clear {slug}

php artisan PageCache:clear {slug} --recursive