mcprohosting / cloudflare-4
PHP package for the next generation CloudFlare API
Installs: 45
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 5
Forks: 3
Open Issues: 1
pkg:composer/mcprohosting/cloudflare-4
Requires
- php: >=5.4.0
- guzzlehttp/guzzle: ~4.1
- illuminate/support: ~4.2
Requires (Dev)
- mockery/mockery: 0.9.*
- phpunit/phpunit: 3.7.*
This package is not auto-updated.
Last update: 2025-10-21 12:37:02 UTC
README
A PHP package for the next generation of CloudFlare API.
Usage Overview
// Set up the request Factory $factory = new RequestFactory(); $factory->setEmail('FooEmail'); $factory->setKey('FooKey'); // Make a request $request = $factory->make(); // And run a response $response = $request->zoneList(); // Alternately, `$response = $factory->zoneList();` does the same thing. if (!$response->didSucceed()) { var_dump($response->getErrors()); die('Something went wrong!'); } else { var_dump($response->getData()); }
Available Methods
You can pass arguments in, or simply pass an associative array as the first argument, where keys are the argument names and values are the corresponding values. Example:
$factory->dnsGet('a', 'b');
// is the same as...
$factory->dnsGet([['zone_id' => 'a', 'dns_id' => 'b']]);
This may be preferable for functions with very long argument lists.
ResponseInterface zoneCreate(mixed $name, bool $jump_start = null, array $organization = null)ResponseInterface zoneList(mixed $name = null, string $status = null, integer $page = null, integer $per_page = null, string $order = null, string $direction = null, string $match = null)ResponseInterface zoneGet(mixed $id)ResponseInterface zonePause(mixed $id)ResponseInterface zoneResume(mixed $id)ResponseInterface zonePurge(mixed $id, bool $purge_everything)ResponseInterface zonePurgeFiles(mixed $id, array $files = null)ResponseInterface zoneDelete(mixed $id)ResponseInterface plansList(mixed $zone_id)ResponseInterface plansGet(mixed $zone_id, string $plan_id)ResponseInterface plansSet(mixed $zone_id, string $plan_id)ResponseInterface dnsCreate(mixed $zone_id, string $type = null, string $name = null, string $content = null, integer $ttl = null)ResponseInterface dnsList(mixed $zone_id, string $name = null, string $content= null, string $vanity_name_server_record = null, integer $page = null, integer $per_page = null, string $order = null, string $direction = null, string $match = null)ResponseInterface dnsGet(mixed $zone_id, string $dns_id)ResponseInterface dnsUpdate(mixed $zone_id, string $dns_id, array $__data__)ResponseInterface dnsDelete(mixed $zone_id, string $dns_id)
For further information about specific functions, see the CloudFlare documentation. All of these return instances of ResponseInterface, which implements the following methods:
array getData()- Returns the array of the "results" from the CloudFlare response.mixed getErrors()- Returns the array of "errors" from the CloudFlare response.bool didSucceed()- Returns the "success" of the CloudFlare response, true or false.