PHP code example of assertchris / cloudflare-security-rule-sync

1. Go to this page and download the library: Download assertchris/cloudflare-security-rule-sync 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/ */

    

assertchris / cloudflare-security-rule-sync example snippets


return [
    'api_token' => env('CF_API_TOKEN'),
    'zone_id' => env('CF_ZONE_ID'),

    'rule' => [
        'description' => env('CF_RULE_DESCRIPTION', 'cloudflare-security-rule-sync'),
        'action' => env('CF_RULE_ACTION', 'block'),
        'ignorable_paths' => ['/_dusk/*', '/_boost/*'],
        'forced_allow_paths' => [],
        'hostnames' => [],
    ],
];
bash
php artisan vendor:publish --tag=cloudflare-security-rule-sync-config
bash
php artisan cloudflare:sync-security-rule
bash
php artisan cloudflare:sync-security-rule --sync
bash
php artisan cloudflare:sync-security-rule --sync