hades-architect/united-domains

一个用于使用United Domains domainreselling.de API的库

0.3.0 2018-04-18 08:07 UTC

This package is not auto-updated.

Last update: 2024-09-15 06:28:37 UTC


README

Build Status

一个方便使用United Domains API的工具。它提供了直接API调用和方便的包装器。

安装

composer require hades-architect/united-domains 0.2.1

使用

简单客户端

当你想要保持简单时推荐的方式。提供了更方便地使用API的方法,但不涵盖所有已知的API方法。

$client = new \HadesArchitect\UnitedDomains\ClientFacade($username, $password);
$records = $client->getRecords('my-domain.com');
if ($client->isDomainFree('example.com')) { ... }

强大客户端

没有花哨的界面方法,而是只提供主要的 call 方法。直接使用API的方式。没有限制,但强大的力量伴随着巨大的责任 ;)

$client = new \HadesArchitect\UnitedDomains\Client($username, $password);
$response = $client->call('CheckDomain', ['domain' => 'example.com']);
echo $response;

可追踪客户端

当你调试问题时,它会产生更多的输出。

// Client
$client = new \HadesArchitect\UnitedDomains\TraceableClient($username, $password);
// Logger 
$client->setLogger(
    new \Monolog\Logger(
        'ud_api',
        [new \Monolog\Handler\StreamHandler('php://stdout', \Monolog\Logger::DEBUG)],
        [new \Monolog\Processor\PsrLogMessageProcessor()]
    )
);
$client->enableDebug();
$response = $client->call('CheckDomain', ['domain' => 'example.com']);
echo $response;

待办事项

  • 更多测试
  • 与Travis CI集成
  • 为ClientFacade添加更多方法