Skip to content

pleets/name-com-sdk

Repository files navigation

Build Status Code Quality Code Coverage

Name.com SDK

This is an SDK for Name.com REST API. The following APIs are currently supported 🚀.

Bugs Bugs Bugs

Installation

Use following command to install this library:

composer require pleets/name-com-api

Usage

Go to Name.com site and get a username and token in API Settings. Use this credentials to authenticate against Name.com as follows:

use Pleets\NameCom\NameComApi;

$service = new NameComApi('https://api.name.com');
$service->setCredentials('user-prod', 'fb229991b131304b390f1a633148a3832044d2b4');

For instance, if you want to get all details about a specific domain you can use the getDomain method.

$response = $service->getDomain('example.com');

All responses have a method to know if the request was successful.

if ($response->isSuccessful()) {
    // all it's ok
}

No matter the success of the response, you can always check the JSON response with toArray().

$response->toArray();

As well, you can access to the returned HTTP status code as follows:

$response->getResponse()->getStatusCode();

See all available methods for this API in the Wiki.

Releases

No releases published

Packages

No packages published

Languages