PHP code example of rabbit-loader / php-sdk

1. Go to this page and download the library: Download rabbit-loader/php-sdk 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/ */

    

rabbit-loader / php-sdk example snippets


#load vendor/autoload.php

#integrate RabbitLoader
$licenseKey = 'YOUR_LICENSE_KEY'; //get your license key from environment variable
$storageDir = '/cache-disk/rabbitloader'; //storage location where cached files will be stored
$rlSDK = new RabbitLoader\SDK\RabbitLoader($licenseKey, $storageDir);
$rlSDK->process();

#remaining code of the website goes after this ...
echo "<h1>Hello World!</h1>"

#admin.php

$urlModified = 'https://mywebsite.com/modified-page-slug/';
$rlSDK->onContentChange($urlModified);

#if home page needs to be purged too, then-
$rlSDK->onContentChange('https://mywebsite.com/');

//skip caching if path starts with admin
$rlSDK->skipForPaths(['/admin*']);

//skip caching if a cookie is found with name cookie1 
$rlSDK->skipForCookies(['cookie1']);

//all the above options should come before the process() call
$rlSDK->process();
bash
composer