Domain Information

This function allows you to build and return an object representing a given domain. The attributes of the object can include data including nameservers, expiry date, registrar and transfer lock status, domain contact verification status and more.

In WHMCS 7.6 and later, it is recommended to use the GetDomainInformation function in place of the individual GetNameservers and GetRegistrarLock functions in scenarios where a single API call can retrieve both nameservers and registrar lock status for best performance.

Note this function is only available in WHMCS 7.6.0 and later.

Example Usage

The function expects a return of a WHMCS Registrar Domain object.

The example below demonstrates setting all supported domain attributes at the time of writing.

use WHMCS\Carbon;
use WHMCS\Domain\Registrar\Domain;

function modulename_GetDomainInformation($params) {
     * Perform API call to retrieve domain information. This example assumes
     * $response is populated with an array of data returned by the Registrar's API.
	$response = [];

	return (new Domain)
        ->setExpiryDate(Carbon::createFromFormat('Y-m-d', $response['expirydate'])) // $response['expirydate'] = YYYY-MM-DD
        ->setIsIrtpEnabled(in_array($response['tld'], ['.com']))
                'Registrant' => [
                    'First Name',
                    'Last Name',
                    'Organization Name',

If an error is encountered while attempting to fetch the domain information, you should throw an exception. All exceptions will be caught by WHMCS and the exception message displayed to the end user.

Method signatures for the WHMCS\Domain\Registrar\Domain class can be found in the WHMCS Class Documention.