/UnitedDomains

A PHP Client for United Domains API

Primary LanguagePHPMIT LicenseMIT

United Domains PHP Client Library

Build Status

A convenient tool to use United Domains API. It provides tools for direct API calls and convenient wrappers.

Installation

composer require hades-architect/united-domains 0.2.1

Usage

Simple Client

Recommended way when you would like to have it simple. Provides more convenient way to use API but doesn't cover all known API methods.

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

Powerful Client

Doesn't have fancy facade methods giving you instead only the main call method. The way to use API directly. No limits, but great power brings great responsibility ;)

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

Traceable Client

It brings more output if you debug something.

// 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;

Todo

  • More tests
  • Integration with Travis CI
  • More methods for ClientFacade