thepublicgood / names
API client for domains.co.za resellers.
Requires
- php: ^8.2
- illuminate/support: ^9.51
- nesbot/carbon: ^2.66
- php-http/discovery: ^1.15
- php-http/message-factory: ^1.0
- psr/http-client-implementation: ^1.0
- psr/http-message: ^1.0
Requires (Dev)
- guzzlehttp/guzzle: ^7.5
- laravel/pint: ^1.4
- pestphp/pest: ^1.22
- pestphp/pest-plugin-mock: ^1.0
- php-http/guzzle7-adapter: ^1.0
- php-http/mock-client: ^1.0
- ramsey/uuid: ^4.7
- symfony/var-dumper: ^6.2
This package is auto-updated.
Last update: 2024-12-12 16:48:22 UTC
README
PHP client for the domains.co.za reseller API.
A full-featured PHP client for working with the domains.co.za reseller API. This is brand new and is a work in progress. It should not be used in production. It is likely to change significantly before reaching version 1.0.
You will need to have an active domains.co.za reseller account. You will need to provide your username and password to generate a new authentication token, or if you already have a token, you can provide that instead. Note that the library does not support 2 factor authentication.
Installation
There are no versions just yet, so you will need to make sure your composer.json
file has "minimum-stability": "dev"
set.
The Names library is not bound to any HTTP client library and you can install any PSR-7, PST-17 and PSR-18 compatible library. A good start could be:
composer require thepublicgood/names guzzlehttp/guzzle php-http/guzzle7-adapter
Usage
Create a new instance of the Names
class and pass in your token if you have one. Otherwise, you can pass your username and password to the authenticate
method:
$names = new \TPG\Names\Names(token: $token); // or $names = new \TPG\Names\Names(); $auth = $names->authenticate($username, $password); $token = $auth->token;
Reseller Object
Many responses will included a Reseller
object:
$reseller = $response->reseller; $reseller->username; // string $reseller->balance; // float $reseller->accountType; // string $reseller->lowBalance; // bool
Domains
Checking if a domain is available
$check = $names->domains()->check('is-this-available.com'); $check->requiresEpp; // bool $check->isAvailable; // bool $check->eppKey; // string $check->tld; // string $check->sld; // string $check->isPremium; // bool $check->reseller; // Reseller object
Getting a list of registered domains
$list = $names->domains()->list(); // or // Get a list of expired domains $names->domains()->expired(); // Get a list of domains expiring next month $names->domains()->expiringNextMonth(); // Get a list of suspended domains $names->domains()->suspended(); // Get a list of domains currently in redemption $names->domains()->redemption();
Each domain returned is a Domain
object:
$domain = $names->domains()->list()->first(); $domain->name; // string $domain->contactName; // string $domain->contactId; // string $domain->status; // string $domain->eppStatus; // string $domain->premiumDns; // bool $domain->createdAt; // Carbon $domain->expiresAt; // Carbon $domain->redemptionDate; // Carbon $domain->deletionDate; // Carbon $domain->autoRenew; // bool $domain->externalReference; // string $domain->nameservers; // array
Credits
License
The MIT License (MIT). See the LICENSE.md file for more details.