mcstutterfish/cloudflare

Cloudflare API PHP 封装器

v0.1.0 2015-07-29 14:35 UTC

This package is not auto-updated.

Last update: 2024-09-14 17:48:16 UTC


README

#Cloudflare API PHP 封装器

我正在逐步使用更多 Cloudflare 的功能并添加更多功能。请提交任何特定的请求,因为这可能是我知道我很快需要并且可以实现的功能。

##安装 安装应通过 composer 完成,有关如何安装 composer 的详细信息,请访问 https://getcomposer.org.cn/

"mcstutterfish/cloudflare": "dev-master" 添加到您的 composer.json 文件中

运行 composer update 以安装最新版本。

##使用

在需要在不同服务中对 API 进行多次调用的情况下,首先创建对 API 的连接,然后再将其传递给其他服务会更简单,例如:

    use Cloudflare;
    use Cloudflare\Zone\Dns;

    // Create a connection to the Cloudflare API which you can
    // then pass into other services, e.g. DNS, later on
    $client = new Cloudflare\Api('email@example.com', 'API_KEY');

    // Create a new DNS record
    $dns = new Cloudflare\Dns($client);
    $dns->create('12345678901234567890', 'TXT', '127.0.0.1', 120);

如果您只是执行单个操作,则可以在实例化类时直接连接到 API,例如:

    use Cloudflare;

    // Create a connection to the Cloudflare API which you can
    // then pass into other services, e.g. DNS, later on
    $dns = new Cloudflare\Zone\Dns('email@example.com', 'API_KEY');
    $dns->create('12345678901234567890', 'TXT', '127.0.0.1', 120);

##许可证 MIT