1. Go to this page and download the library: Download emgag/varnish-towncrier 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/ */
emgag / varnish-towncrier example snippets
use Emgag\VarnishTowncrier\VarnishTowncrier;
$client = new Predis\Client([
'scheme' => 'tcp',
'host' => '127.0.0.1',
'port' => '6379'
]);
$vb = new VarnishTowncrier($client);
// BAN using a varnish VCL expression
$vb->ban('example.org', 'expression');
$vb->ban('example.org', ['multiple', 'expressions']);
// BAN using an URL pattern
$vb->banURL('example.org', 'pattern');
$vb->banURL('example.org', ['multiple', 'patterns']);
// PURGE using a path
$vb->purge('example.org', 'path');
$vb->purge('example.org', ['multiple', 'paths']);
// Purge cache surrogate keys
$vb->xkey('example.org', 'key');
$vb->xkey('example.org', ['multiple', 'keys']);
// Soft purge cache surrogate keys
$vb->xkeySoft('example.org', 'key');
$vb->xkeySoft('example.org', ['multiple', 'keys']);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.