Skip to main content

PHP SDK Guide

Installation

This SDK can be installed via composer.

$ composer require privyreza/rm-php-sdk

Usage

Make sure you already got you developer token. If you dont have the token refer to this guide: - and that its set properly using this guide: -

Initialization

require "vendor/autoload.php";

// Load the Client
use Resellme\Client;

// Get token from env
$token = getenv('RM_TOKEN');

// Initialize the Client
$client = new Client($token);

Check Domain Availability

$domain = 'resellme-testdomain.co.zw';

/*
* Check availability
* @return array - with domain status
*
*/
$domainSearch = $client->searchDomain($domain);

Registering a New Domain

Make sure you are testing on the sandbox platform.

/**
* Domain Details
*
*/
// Domain Owner
$contact = [
"contacts" => [
"registrant" => [
"first_name" => "SDK Privy",
"last_name" =>"SDK Reza",
"email" =>"privyreza@xxx.com",
"company" =>"SDK Company",
"mobile" =>"0773234827",
"street_address" =>"78 Test Street",
"core_business" =>"SDK Test Core Business",
"city" =>"Nairobi",
"country" =>"Kenya"
]
]
];

// Nameservers
$nameservers = [
"ns1" => "ns1.cloud-dns.com",
"ns2" => "ns2.cloud-dns.com"
];

// Prepare the data
$data = [
'domain' => $domain,
'nameservers' => $nameservers,
'contacts' => $contacts
];

/**
* Register the domain now
* @return array
*
*/
$domain = $client->registerDomain($data);

Get Domains

You can use this to fetch all your domains. You can pass filters if you want a filtered result.

$filters = [
'status' => 'registered', // Get Registered only domains
'name' => 'resellme-testdomain.co.zw' // Get By Domain name
];

$domains = $client->getDomains($filters);