PHP code example of ckdot / page-cache

1. Go to this page and download the library: Download ckdot/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/ */

    

ckdot / page-cache example snippets


Silber\PageCache\LaravelServiceProvider::class,

protected $middlewareGroups = [
    'web' => [
        \Silber\PageCache\Middleware\CacheResponse::class,
        /* ... keep the existing middleware here */
    ],
];

protected $routeMiddleware = [
    'page-cache' => Silber\PageCache\Middleware\CacheResponse::class,
    /* ... keep the existing mappings here */
];

Route::middleware('page-cache')->get('posts/{slug}', 'PostController@show');

php artisan page-cache:clear