dev-master
9999999-devA CakePHP component to use the CloudFlare in PHP
WTFPL
The Requires
A CakePHP component to use the CloudFlare in PHP
This plugin is a (very) thin veil over vexxhost's CloudFlare-API for use in CakePHP controllers. Please use composer to install so that the required dependencies are installed, (*1)
Add to composer, this will also install the Amazon SDK for PHP as a dependency, (*2)
"ali1/cakephp-cloudflare-api": "dev-master"
You must add configuration to bootstrap.php., (*3)
Configure::write('CloudFlareApi.email', 'CLOUDFLARE EMAIL'); Configure::write('CloudFlareApi.apiKey', 'CLOUDFLARE API KEY');
Add the component to a controller, (*4)
public $components = array('CloudFlareApi.CloudFlareApi');
Remove a file from the cache, (*5)
$this->CloudFlareApi->zone_file_purge('mydomain.com', 'http://forum.mydomain.com/images/logo.png');
From a model or shell, (*6)
if (!isset($this->CloudFlareApi)) { App::import('Component', 'CloudFlareApi.CloudFlareApi'); $collection = new ComponentCollection(); $Controller =& new Controller(); $this->CloudFlareApi = new CloudFlareApiComponent($collection); $this->CloudFlareApi->initialize($Controller); } $this->CloudFlareApi->zone_file_purge('mydomain.com', 'http://forum.mydomain.com/images/logo.png');
From a console, (*7)
Console/cake CloudFlareApi.call fpurge_ts mydomain.com Console/cake CloudFlareApi.call zone_file_purge mydomain.com http://forum.mydomain.com/images/logo.png, (*8)
You can find the method definitions here: https://github.com/vexxhost/CloudFlare-API/blob/master/class_cloudflare.php, (*9)
A CakePHP component to use the CloudFlare in PHP
WTFPL