Domain registrars

Check availability

checkDomain()

This function is used for each query if a domain is available. This query can be initiated by a customer in the storefront, an external module or via admin panel.

This function is optional If not implemented, the default HwWHOIS will be used. Some domain registrars do not provide their own WHOIS API endpoints which can be implemented.

Parameters

You get both the TLD and SLD of the requested domain. If the customer searches for "hostware.io", you get the following input:

Type

Name

Description

String

$sld

The SLD part, e.g. "hostware"

String

$tld

The TLD part, e.g. "io"

Response

DomainCheckResponse() class.

Type

Name

Description

bool

$available

If the domain is available or not

null or String

$whoisResponse

The actual WHOIS response, if returned by the module. Can be empty.

Example Code

public function checkDomain(string $sld, string $tld): DomainCheckResponse {

    $data = $this->getClient()->domains()->isAvailable($sld, $tld);

    return new DomainCheckResponse(
        $data->data->available
    );
}

Testing

Perform an availability check in the storefront on the domain listing page. This requires a Domain TLD Price to be attached to this module, so the function gets executed.

Was this helpful?