2017 © Pedro Peláez
 

cakephp-plugin cakephp-cloudflare-api

A CakePHP component to use the CloudFlare in PHP

image

ali1/cakephp-cloudflare-api

A CakePHP component to use the CloudFlare in PHP

  • Saturday, April 19, 2014
  • by Ali1
  • Repository
  • 1 Watchers
  • 2 Stars
  • 2,846 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 2 % Grown

The README.md

CloudFlare API plugin for CakePHP 2.0+

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)

Composer Installation

  • Add to composer, this will also install the Amazon SDK for PHP as a dependency, (*2)

    "ali1/cakephp-cloudflare-api": "dev-master"

Non-composer Installation

  • Place the contents of this repo in Plugin/CloudFlareApi
  • Download the contents of https://github.com/vexxhost/CloudFlare-API into Plugin/CloudFlareApi/Vendor/vexxhost/cloud-flare-api

Configuration

  • You must add configuration to bootstrap.php., (*3)

    Configure::write('CloudFlareApi.email', 'CLOUDFLARE EMAIL');
    Configure::write('CloudFlareApi.apiKey', 'CLOUDFLARE API KEY');
    • Don't forget to replace the placeholder text with your actual keys!
  • Add the component to a controller, (*4)

    public $components = array('CloudFlareApi.CloudFlareApi');

Example

  • 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)

Notes

You can find the method definitions here: https://github.com/vexxhost/CloudFlare-API/blob/master/class_cloudflare.php, (*9)

The Versions

19/04 2014

dev-master

9999999-dev

A CakePHP component to use the CloudFlare in PHP

  Sources   Download

WTFPL

The Requires