jdubreville/dnsimple

dnsimple REST API 的 PHP 客户端。

dev-master 2016-12-02 16:38 UTC

This package is not auto-updated.

Last update: 2024-09-14 15:58:03 UTC


README

dnsimple API 的 PHP 客户端。有关参数信息,请参阅DNSimple API 参考

请注意,此项目仍在开发中,代码的部分功能尚未经过测试。

安装

可以使用 Composer 安装 API 客户端。

Composer

{
  "require": {
    "jdubreville/dnsipmle_api_client_php": "dev-master"
  }
}

配置

通过 jduebrville\dnsimple\Client 类的实例配置客户端。

use jdubreville\dnsimple\Client as DNSimpleAPI;

$email = "email@example.com"; // replace with your account email address
$token = "ajfdaojfoawjf98uwejfaw"; // replace with your account token (found in account settings)

$client = new DNSimpleAPI($email, $token);

用法

基本操作

// Get all domains
$domains = $client->domains()->getAll();
print_r($domains);

// Search for a given record.
$domains = $client->domains()->getAll(array('name' => 'some_host_name'));
print_r($domains);

// Create a new domain
$newDomain = $client->domains()->create(array(
  'name' => 'example.com',
  )
));
print_r($newDomain);

// Get a domain
$domain = $client->domains('example.com')->get();
print_r($domain);

// Add a Domain Record
$client->domains('example.com')->records()->create(array(
  'name' => '',
  'record_type' => 'A',
  'content' => '1.2.3.4'
));

// Delete a Domain
$client->domains('example.com')->delete();

关于补丁/拉取请求的说明

  1. 将项目分支出来。
  2. 进行修改。
  3. 为其添加测试。这样,未来的发布可以经过验证。
  4. 提交您的更改。
  5. 发送拉取请求。

许可证

MIT 许可证下授权

有关更多信息,请参阅 LICENSE 文件。