PHP code example of studioespresso / craft-varnish-purger
1. Go to this page and download the library: Download studioespresso/craft-varnish-purger 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/ */
studioespresso / craft-varnish-purger example snippets
'production' => [
'purgeUrls' => ['https://www.example.com'],
// Connect to this IP for the purge URL's hostname, like an /etc/hosts entry just for purging. Use it when DNS
// points elsewhere (e.g. Cloudflare) but the hostname must stay in the URL (shared hosting routes on it, HTTPS needs it).
'resolve' => ['www.example.com' => '203.0.113.10'],
// Only ban pages cached under these hostnames: needed when other sites share the same Varnish. List every
// hostname this install's pages are cached under (www-variants, aliases): pages under a missing one are never purged.
'hostnames' => ['example.com', 'www.example.com'],
],
bash
php craft varnish/purge # every page
php craft varnish/purge --tags=12,e:s:3 # only pages with these tags (element 12, entries of section 3)
php craft varnish/purge --site=french # only pages of one site (handle or ID)
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.