PHP code example of handmadeweb / statamic-cloudflare

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

    

handmadeweb / statamic-cloudflare example snippets


    /*
     * Array of zones.
     *
     * Each zone must have its domain as the key. The value should be your zoneId.
     *
     * you can find your zoneId under 'Account Home > site > Api'.
     *
     * E.g.
     *
     * 'example.com' => '023e105f4ecef8ad9ca31a8372d0c353'
     */
    'zones' => [
        // env('CLOUDFLARE_ZONE_DOMAIN', null) => env('CLOUDFLARE_ZONE_ID', null),
    ],

    /*
     * Should purges be processed in a queue?
     * CLI commands will always run on request.
     */
    'queued' => true,

/**
 * Register any application services.
 *
 * @return void
 */
public function register()
{
    \HandmadeWeb\StatamicCloudflare\Cloudflare::registerCacher();
}

'strategies' => [

    'half' => [
        'driver' => 'application',
        'expiry' => null,
    ],

    'full' => [
        'driver' => 'file',
        'path' => public_path('static'),
        'lock_hold_length' => 0,
    ],

    'cloudflare' => [
        'driver' => 'cloudflare',
        'strategy' => 'null',
    ],
],

'strategy' => 'cloudflare',

'cloudflare' => [
    'driver' => 'cloudflare',
    'strategy' => 'half',
],
shell
php artisan vendor:publish --provider="HandmadeWeb\StatamicCloudflare\ServiceProvider"
shell
php artisan cloudflare:cache:purge:everything
shell
php please cloudflare:cache:purge:everything