Overview

Namespaces

  • Cloudflare
    • Organizations
      • Firewall
        • AccessRules
    • User
      • Billing
        • Subscriptions
      • Firewall
    • Zone
      • Firewall
      • SSL
      • WAF
        • Packages

Classes

  • Api
  • Certificates
  • IPs
  • Railguns
  • User
  • Zone
  • Overview
  • Namespace
  • Class

Class Api

CloudFlare API wrapper

A work in progress library for the Cloudflare API. The documentation for the API can be found at https://www.cloudflare.com/docs/.

Direct known subclasses

Cloudflare\Certificates, Cloudflare\IPs, Cloudflare\User, Cloudflare\User\Billing, Cloudflare\User\Billing\Subscriptions\Apps, Cloudflare\User\Billing\Subscriptions\Zones, Cloudflare\User\Firewall\AccessRules, Cloudflare\User\Invites, Cloudflare\User\Organizations, Cloudflare\User\Virtual_Dns, Cloudflare\Zone, Cloudflare\Zone\Analytics, Cloudflare\Organizations\Firewall\AccessRules\Rules, Cloudflare\Zone\Cache, Cloudflare\Zone\CustomPages, Cloudflare\Zone\CustomSSL, Cloudflare\Zone\Dns, Cloudflare\Zone\Firewall\AccessRules, Cloudflare\Zone\KeylessSSL, Cloudflare\Zone\Pagerules, Cloudflare\Zone\Plan, Cloudflare\Zone\Railgun, Cloudflare\Zone\Settings, Cloudflare\Organizations\Invites, Cloudflare\Zone\SSL, Cloudflare\Zone\SSL\Analyze, Cloudflare\Zone\SSL\CertificatePacks, Cloudflare\Zone\WAF\Packages, Cloudflare\Zone\WAF\Packages\Groups, Cloudflare\Zone\WAF\Packages\Rules, Cloudflare\Organizations\Members, Cloudflare\Organizations\Organizations, Cloudflare\Organizations\Railguns, Cloudflare\Organizations\Roles, Cloudflare\Organizations\Virtual_Dns, Cloudflare\Railguns
Namespace: Cloudflare
Author: James Bell james@james-bell.co.uk
Version: 1
Located at CloudFlare/Api.php
Methods summary
public
# __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

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
# setEmail( string $email )

Setter to allow the setting of the email address

Setter to allow the setting of the email address

Parameters

$email
The email address associated with the Cloudflare account
public
# setAuthKey( string $token )

Setter to allow the setting of the Authentication Key

Setter to allow the setting of the Authentication Key

Parameters

$token
Authentication key, this can be retrieve from the 'My Account' section of the Cloudflare account
public
# setCurlOption( long $key, mixed $value )

Setter to allow the adding / changing of the Curl options that will be used within the HTTP requests

Setter to allow the adding / changing of the Curl options that will be used within the HTTP requests

Parameters

$key
The CURLOPT_XXX option to set e.g. CURLOPT_TIMEOUT
$value
The value to be set on option e.g. 10
public
# get( string $path, array $data = null )

API call method for sending requests using GET

API call method for sending requests using GET

Parameters

$path
Path of the endpoint
$data
Data to be sent along with the request
public
# post( string $path, array $data = null )

API call method for sending requests using POST

API call method for sending requests using POST

Parameters

$path
Path of the endpoint
$data
Data to be sent along with the request
public
# put( string $path, array $data = null )

API call method for sending requests using PUT

API call method for sending requests using PUT

Parameters

$path
Path of the endpoint
$data
Data to be sent along with the request
public
# delete( string $path, array $data = null )

API call method for sending requests using DELETE

API call method for sending requests using DELETE

Parameters

$path
Path of the endpoint
$data
Data to be sent along with the request
public
# patch( string $path, array $data = null )

API call method for sending requests using PATCH

API call method for sending requests using PATCH

Parameters

$path
Path of the endpoint
$data
Data to be sent along with the request
public
# permissions( )

Retrieves the users' permisison levels

Retrieves the users' permisison levels

protected
# request( string $path, array $data = null, string|null $method = null, string|null $permission_level = null )

Parameters

$path
Path of the endpoint
$data
Data to be sent along with the request
$method
Type of method that should be used ('GET', 'POST', 'PUT', 'DELETE', 'PATCH')
$permission_level
Permission level required to preform the action

Codecoverageignore

API call method for sending requests using GET, POST, PUT, DELETE OR PATCH
Properties summary
protected array $permission_level

Default permissions level

Default permissions level

# ['read' => null, 'edit' => null]
public string $email

Holds the provided email address for API authentication

Holds the provided email address for API authentication

#
public string $auth_key

Holds the provided auth_key for API authentication

Holds the provided auth_key for API authentication

#
public array $curl_options

Holds the curl options

Holds the curl options

#
API documentation generated by ApiGen