mcprohosting / cloudflare-4
适用于下一代 CloudFlare API 的 PHP 包
0.0.1
2014-07-31 14:58 UTC
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: 2024-09-24 07:01:44 UTC
README
这是一个适用于下一代 CloudFlare API 的 PHP 包。
使用概述
// 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()); }
可用方法
您可以在其中传递参数,或者简单地传递一个关联数组作为第一个参数,其中键是参数名称,值是相应的值。示例
$factory->dnsGet('a', 'b');
// is the same as...
$factory->dnsGet([['zone_id' => 'a', 'dns_id' => 'b']]);
这可能更适合具有非常长参数列表的函数。
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)
有关特定函数的更多信息,请参阅 CloudFlare 文档。所有这些都返回 ResponseInterface 实例,它实现了以下方法
array getData()- 返回 CloudFlare 响应的 "results" 数组。mixed getErrors()- 返回 CloudFlare 响应的 "errors" 数组。bool didSucceed()- 返回 CloudFlare 响应的 "success",true 或 false。