PHP code example of thestreamable / kirby-clear-cloudflare-cache
1. Go to this page and download the library: Download thestreamable/kirby-clear-cloudflare-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/ */
thestreamable / kirby-clear-cloudflare-cache example snippets
'thathoff.clearcloudflarecache.cloudflareZoneID' => 'YOUR_CF_ZONE_ID',
'thathoff.clearcloudflarecache.cloudflareEmail' => 'YOUR_CF_EMAIL',
'thathoff.clearcloudflarecache.cloudflareAPIKey' => 'YOUR_CF_API_KEY',
function ($hook, $page, $oldPage = null) {
return $oldPage ? [$page->url(), $oldPage->url()] : $page->url();
}
'thathoff.clearcloudflarecache.dependantUrlsForPage'=> function ($hook, $page, $oldPage = null) {
return $page->parents()->add($page->siblings(true));
},
'thathoff.clearcloudflarecache.dependantUrlsForPage'=> function ($hook, $page, $oldPage = null) {
$urls = [];
$urls[] = $page->url();
$urls[] = $page->url() . '.json';
if ($oldPage) {
$urls[] = $oldPage->url();
$urls[] = $oldPage->url() . '.json';
}
$urls[] = page('sitemap')->url();
$urls[] = page('sitemap')->url() . '.xml';
return $urls;
},