Overview
Commerce's registrar system is fully pluggable. To add support for any registrar, create a class in app/Registrar/Modules/ implementing DomainRegistrarModule. The RegistrarService discovers it automatically — no migrations, no service providers, no config changes required.
Step 1 — Create the Module File
app/Registrar/Modules/MyRegistrarModule.php
Step 2 — Implement the Interface
<?php
namespace App\Registrar\Modules;
use App\Contracts\DomainRegistrarModule;
use App\Models\Domain;
use App\Registrar\DomainCheckResult;
use App\Registrar\DomainResult;
class MyRegistrarModule implements DomainRegistrarModule
{
public static function moduleId(): string { return 'myregistrar'; }
public static function moduleLabel(): string { return 'My Registrar'; }
public function checkAvailability(string $sld, string $tld): DomainCheckResult { ... }
public function checkBulkAvailability(string $sld, array $tlds): array { ... }
public function register(Domain $domain, array $contacts, int $years): DomainResult { ... }
public function renew(Domain $domain, int $years): DomainResult { ... }
public function transfer(Domain $domain, string $eppCode, array $contacts): DomainResult { ... }
public function getDomainInfo(Domain $domain): DomainResult { ... }
public function updateNameservers(Domain $domain, array $nameservers): DomainResult { ... }
public function getEppCode(Domain $domain): DomainResult { ... }
public function setLock(Domain $domain, bool $locked): DomainResult { ... }
public function setPrivacy(Domain $domain, bool $enabled): DomainResult { ... }
public function testConnection(): DomainResult { ... }
}
Interface Methods Reference
| Method | Parameters | Return | Description |
|---|---|---|---|
checkAvailability |
sld, tld |
DomainCheckResult |
Check if one domain is available |
checkBulkAvailability |
sld, tlds[] |
DomainCheckResult[] |
Check multiple TLDs in one call |
register |
Domain, contacts[], years |
DomainResult |
Register a new domain |
renew |
Domain, years |
DomainResult |
Renew an existing domain |
transfer |
Domain, eppCode, contacts[] |
DomainResult |
Initiate an inbound transfer |
getDomainInfo |
Domain |
DomainResult |
Fetch current domain state from registrar |
updateNameservers |
Domain, nameservers[] |
DomainResult |
Update nameservers at registrar |
getEppCode |
Domain |
DomainResult |
Fetch auth/EPP code from registrar |
setLock |
Domain, bool |
DomainResult |
Enable or disable transfer lock |
setPrivacy |
Domain, bool |
DomainResult |
Enable or disable WHOIS privacy |
testConnection |
(none) | DomainResult |
Lightweight connectivity + auth check |
DTOs
DomainCheckResult
DomainCheckResult::available($domain, $tld, $price)
DomainCheckResult::taken($domain, $tld)
DomainCheckResult::error($domain, $tld, 'error message')
| Property | Type | Description |
|---|---|---|
domain |
string | SLD portion |
tld |
string | TLD portion |
available |
bool | True if available |
premium |
bool | True if premium-priced domain |
price |
int|null | Retail price in cents (for available domains) |
error |
string|null | Error message if check failed |
DomainResult
DomainResult::success('Registered successfully.', ['expiry_date' => '2027-04-15'])
DomainResult::failure('API returned: domain not available.')
| Property | Type | Description |
|---|---|---|
success |
bool | Whether the action succeeded |
message |
string | Human-readable result |
data |
array | Arbitrary data (expiry_date, epp_code, nameservers, etc.) |
error |
string|null | Error string on failure |
Storing and Reading Credentials
Credentials are stored in the settings table under group registrar with keys following the pattern {module_slug}_{field_name}.
Reading a credential in your module:
use App\Models\Setting;
$apiKey = Setting::get('registrar_myregistrar_api_key');
$sandbox = Setting::get('registrar_myregistrar_sandbox');
Exposing Credential Fields in the Settings UI
Add a case 'myregistrar': block to the registrar settings view (resources/views/admin/settings/registrar.blade.php). Define the fields your module needs using the same field component pattern as the built-in modules.
Auto-Discovery
After deploying the file and clearing opcache, the module appears automatically in the registrar module dropdown in Admin → Settings → Registrar.