PHP Class CloudFlare\Api

A work in progress library for the Cloudflare API. The documentation for the API can be found at https://www.cloudflare.com/docs/.
Author: James Bell ([email protected])
Mostrar archivo Open project: jamesryanbell/cloudflare Class Usage Examples

Public Properties

Property Type Description
$auth_key string Holds the provided auth_key for API authentication
$curl_options array Holds the curl options
$email string Holds the provided email address for API authentication

Public Methods

Method Description
__construct ( ) Make a new instance of the API client This can be done via providing the email address and api key as seperate parameters or by passing in an already instantiated object from which the details will be extracted
delete ( string $path, array $data = null ) : mixed API call method for sending requests using DELETE
get ( string $path, array $data = null ) : mixed API call method for sending requests using GET
patch ( string $path, array $data = null ) : mixed API call method for sending requests using PATCH
post ( string $path, array $data = null ) : mixed API call method for sending requests using POST
put ( string $path, array $data = null ) : mixed API call method for sending requests using PUT
setAuthKey ( string $token ) Setter to allow the setting of the Authentication Key
setCurlOption ( integer $key, mixed $value ) Setter to allow the adding / changing of the Curl options that will be used within the HTTP requests
setEmail ( string $email ) Setter to allow the setting of the email address

Protected Methods

Method Description
request ( string $path, array $data = null, string | null $method = null ) : mixed

Method Details

__construct() public method

Make a new instance of the API client This can be done via providing the email address and api key as seperate parameters or by passing in an already instantiated object from which the details will be extracted
public __construct ( )

delete() public method

API call method for sending requests using DELETE
public delete ( string $path, array $data = null ) : mixed
$path string Path of the endpoint
$data array Data to be sent along with the request
return mixed

get() public method

API call method for sending requests using GET
public get ( string $path, array $data = null ) : mixed
$path string Path of the endpoint
$data array Data to be sent along with the request
return mixed

patch() public method

API call method for sending requests using PATCH
public patch ( string $path, array $data = null ) : mixed
$path string Path of the endpoint
$data array Data to be sent along with the request
return mixed

post() public method

API call method for sending requests using POST
public post ( string $path, array $data = null ) : mixed
$path string Path of the endpoint
$data array Data to be sent along with the request
return mixed

put() public method

API call method for sending requests using PUT
public put ( string $path, array $data = null ) : mixed
$path string Path of the endpoint
$data array Data to be sent along with the request
return mixed

request() protected method

protected request ( string $path, array $data = null, string | null $method = null ) : mixed
$path string Path of the endpoint
$data array Data to be sent along with the request
$method string | null Type of method that should be used ('GET', 'POST', 'PUT', 'DELETE', 'PATCH')
return mixed

setAuthKey() public method

Setter to allow the setting of the Authentication Key
public setAuthKey ( string $token )
$token string Authentication key, this can be retrieve from the 'My Account' section of the Cloudflare account

setCurlOption() public method

Setter to allow the adding / changing of the Curl options that will be used within the HTTP requests
public setCurlOption ( integer $key, mixed $value )
$key integer The CURLOPT_XXX option to set e.g. CURLOPT_TIMEOUT
$value mixed The value to be set on option e.g. 10

setEmail() public method

Setter to allow the setting of the email address
public setEmail ( string $email )
$email string The email address associated with the Cloudflare account

Property Details

$auth_key public_oe property

Holds the provided auth_key for API authentication
public string $auth_key
return string

$curl_options public_oe property

Holds the curl options
public array $curl_options
return array

$email public_oe property

Holds the provided email address for API authentication
public string $email
return string