1. Go to this page and download the library: Download vatia/laravel-varnish 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/ */
return [
/*
* The location of the file containing the administrative password.
*/
'administrative_secret' => '/etc/varnish/secret',
/*
* The host where the administrative tasks may be sent to.
*/
'administrative_host' => '127.0.0.1',
/*
* The port where the administrative tasks may be sent to.
*/
'administrative_port' => 6082,
/*
* The default amount of minutes that content rendered using the `CacheWithVarnish`
* middleware should be cached.
*/
'cache_time_in_minutes' => 60 * 24,
/*
* The name of the header that triggers Varnish to cache the response.
*/
'cacheable_header_name' => 'X-Cacheable',
];