### Install Realtime Register PHP SDK Source: https://github.com/realtimeregister/realtimeregister-php/blob/master/README.md Installs the Realtime Register PHP SDK using Composer. This is the first step to integrating the SDK into your PHP project. ```bash composer require realtimeregister/realtimeregister-php ``` -------------------------------- ### Register Domain with Realtime Register PHP SDK Source: https://context7.com/realtimeregister/realtimeregister-php/llms.txt This PHP code demonstrates how to register a new domain using the Realtime Register PHP SDK. It covers basic registration with essential parameters, advanced registration with additional contacts, and how to get a price quote before actual registration. ```php domains->register( domainName: 'example.com', customer: 'johndoe', registrant: 'contact-handle', privacyProtect: true, period: 12, // months autoRenew: true, ns: ['ns1.example.com', 'ns2.example.com'] ); echo "Domain registered!"; echo "Expiry date: " . $registration->expiryDate->format('Y-m-d'); // Register with additional contacts $contacts = DomainContactCollection::fromArray([ ['role' => 'ADMIN', 'handle' => 'admin-contact'], ['role' => 'TECH', 'handle' => 'tech-contact'], ['role' => 'BILLING', 'handle' => 'billing-contact'], ]); $registration = $client->domains->register( domainName: 'example.net', customer: 'johndoe', registrant: 'registrant-handle', contacts: $contacts, privacyProtect: false, period: 24, autoRenew: true, ns: ['ns1.yourdns.com', 'ns2.yourdns.com'] ); // Get a price quote before registration $quote = $client->domains->register( domainName: 'premium-domain.com', customer: 'johndoe', registrant: 'contact-handle', isQuote: true ); echo "Registration cost: " . $quote->price . " " . $quote->currency; ``` -------------------------------- ### Manage DNS Zones with RealtimeRegister PHP API Source: https://context7.com/realtimeregister/realtimeregister-php/llms.txt This snippet demonstrates how to create, retrieve, update, and delete DNS zones using the RealtimeRegister PHP client. It includes examples for listing zones, getting zone details, creating new zones with records and DNSSEC, triggering key rollovers, and acknowledging DS updates. Requires the RealtimeRegister PHP SDK. ```php dnszones->list(limit: 50); foreach ($zones->entities as $zone) { echo $zone->name . " - " . $zone->service; } // Get zone by ID $zone = $client->dnszones->get(12345); echo "Zone: " . $zone->name; echo "Host Master: " . $zone->hostMaster; // Create a new DNS zone $records = DomainZoneRecordCollection::fromArray([ ['name' => '@', 'type' => 'A', 'content' => '192.168.1.1', 'ttl' => 3600], ['name' => 'www', 'type' => 'CNAME', 'content' => '@', 'ttl' => 3600], ['name' => '@', 'type' => 'MX', 'content' => 'mail.example.com', 'prio' => 10, 'ttl' => 3600], ]); $zoneId = $client->dnszones->create( name: 'example.com', service: ZoneServiceEnum::BASIC, hostMaster: 'hostmaster@example.com', refresh: 10800, retry: 3600, expire: 604800, ttl: 3600, dnssec: true, records: $records ); echo "Created zone ID: " . $zoneId; // Update zone settings $client->dnszones->update( id: $zoneId, ttl: 7200, dnssec: true ); // Get zone statistics $stats = $client->dnszones->statistics($zoneId); echo "Queries: " . $stats->queries; // Trigger DNSSEC key rollover $client->dnszones->keyRollover($zoneId); // Retrieve zone from master (for slave zones) $client->dnszones->retrieve($zoneId); // Acknowledge DS update $client->dnszones->ackDSUpdate($processId); // Delete zone $client->dnszones->delete($zoneId); ``` -------------------------------- ### Get and List Domains with RealtimeRegister PHP Source: https://context7.com/realtimeregister/realtimeregister-php/llms.txt Retrieve details of a single domain or list all domains with pagination, search, and filtering options. Requires the RealtimeRegister SDK and an API key. ```php domains->get('example.com'); echo "Domain: " . $domain->domainName; echo "Registry: " . $domain->registry; echo "Status: " . implode(', ', $domain->status); echo "Expiry: " . $domain->expiryDate->format('Y-m-d'); echo "Auto Renew: " . ($domain->autoRenew ? 'Yes' : 'No'); echo "Nameservers: " . implode(', ', $domain->ns); echo "Registrant: " . $domain->registrant; echo "Privacy Protected: " . ($domain->privacyProtect ? 'Yes' : 'No'); // List domains with pagination $domains = $client->domains->list( limit: 100, offset: 0, search: 'example', parameters: ['status' => 'ok'] ); echo "Total domains: " . $domains->count; foreach ($domains->entities as $domain) { echo $domain->domainName . " - " . $domain->expiryDate->format('Y-m-d'); } // Export all domains $exported = $client->domains->export(['status' => 'ok']); ``` -------------------------------- ### Manage Nameserver Hosts with RealtimeRegister PHP API Source: https://context7.com/realtimeregister/realtimeregister-php/llms.txt This snippet demonstrates how to manage nameserver hosts (glue records) using the RealtimeRegister PHP client. It includes examples for listing all hosts, retrieving host details, creating new hosts with IP addresses, updating host addresses, and deleting hosts. Requires the RealtimeRegister PHP SDK. ```php hosts->list(limit: 50); foreach ($hosts->entities as $host) { echo $host->hostName; foreach ($host->addresses as $addr) { echo " - " . $addr->address . " (" . $addr->ipVersion . ")"; } } // Get host details $host = $client->hosts->get('ns1.example.com'); echo "Host: " . $host->hostName; // Create a new host (glue record) $addresses = DnsHostAddressCollection::fromArray([ ['address' => '192.168.1.1', 'ipVersion' => 'V4'], ['address' => '192.168.1.2', 'ipVersion' => 'V4'], ['address' => '2001:db8::1', 'ipVersion' => 'V6'], ]); $client->hosts->create( hostName: 'ns1.example.com', addresses: $addresses ); // Update host addresses $newAddresses = DnsHostAddressCollection::fromArray([ ['address' => '10.0.0.1', 'ipVersion' => 'V4'], ['address' => '2001:db8::2', 'ipVersion' => 'V6'], ]); $client->hosts->update( hostName: 'ns1.example.com', addresses: $newAddresses ); // Delete host $client->hosts->delete('ns1.example.com'); ``` -------------------------------- ### Get, List, and Update Contacts with PHP Source: https://context7.com/realtimeregister/realtimeregister-php/llms.txt Manage contact records using the RealtimeRegister PHP SDK, including retrieving individual contacts, listing contacts with pagination and search, updating existing contacts, and deleting contacts. ```php contacts->get('johndoe', 'contact-001'); echo "Name: " . $contact->name; echo "Email: " . $contact->email; echo "Organization: " . $contact->organization; echo "Address: " . implode(', ', $contact->addressLine); echo "City: " . $contact->city . ", " . $contact->country; echo "Phone: " . $contact->voice; echo "Created: " . $contact->createdDate->format('Y-m-d'); // List contacts with pagination $contacts = $client->contacts->list( customer: 'johndoe', limit: 50, offset: 0, search: 'john' ); echo "Total contacts: " . $contacts->count; foreach ($contacts->entities as $contact) { echo $contact->handle . " - " . $contact->name; } // Update a contact $client->contacts->update( customer: 'johndoe', handle: 'contact-001', email: 'newemail@example.com', voice: '+1.2125559999' ); // Delete a contact $client->contacts->delete('johndoe', 'contact-001'); ?> ``` -------------------------------- ### Transfer Domain with RealtimeRegister PHP Source: https://context7.com/realtimeregister/realtimeregister-php/llms.txt Initiate a domain transfer from another registrar with all required transfer settings, check transfer status, push transfers, or get a transfer quote. Requires the RealtimeRegister SDK and an API key. ```php domains->transfer( domainName: 'example.com', customer: 'johndoe', registrant: 'registrant-handle', authcode: 'EPP-AUTH-CODE', period: 12, autoRenew: true, ns: ['ns1.example.com', 'ns2.example.com'] ); echo "Transfer status: " . $transfer->status; echo "Process ID: " . $transfer->processId; // Check transfer status $status = $client->domains->transferInfo('example.com'); echo "Current status: " . $status->status; // Push transfer to another registrar $client->domains->pushTransfer('example.com', 'recipient-registrar'); // Get transfer quote $quote = $client->domains->transfer( domainName: 'premium.com', customer: 'johndoe', registrant: 'registrant-handle', authcode: 'AUTH-CODE', isQuote: true ); echo "Transfer cost: " . $quote->price; ``` -------------------------------- ### Retrieve Registry Provider Information with RealtimeRegister PHP SDK Source: https://context7.com/realtimeregister/realtimeregister-php/llms.txt Get information about registry providers, scheduled downtimes, and registry accounts using the RealtimeRegister PHP SDK. This includes listing all providers, retrieving specific provider details, listing and getting scheduled downtimes, and managing registry accounts. ```php providers->list(limit: 50); foreach ($providers->entities as $provider) { echo $provider->name . " - " . $provider->type; } // Get provider details $provider = $client->providers->get('SIDN'); echo "Provider: " . $provider->name; // List scheduled downtimes $downtimes = $client->providers->listDowntimes(); foreach ($downtimes->entities as $downtime) { echo $downtime->provider . ": "; echo $downtime->startDate->format('Y-m-d H:i') . " - "; echo $downtime->endDate->format('Y-m-d H:i'); echo " Reason: " . $downtime->reason; } // Get specific downtime $downtime = $client->providers->getDowntime(123); // List registry accounts (Gateway only) $accounts = $client->providers->listRegistryAccounts(limit: 20); foreach ($accounts->entities as $account) { echo $account->registry . " - " . $account->loginName; } // Get registry account $account = $client->providers->getRegistryAccount('SIDN', 'my-login'); ``` -------------------------------- ### Fetch Top-Level Domain (TLD) Information with RealtimeRegister PHP SDK Source: https://context7.com/realtimeregister/realtimeregister-php/llms.txt Get detailed information about top-level domains including pricing, requirements, and supported features using the RealtimeRegister PHP SDK. This function allows querying specific TLDs like 'com', 'nl', and 'eu' to retrieve their associated properties. ```php tlds->info('com'); echo "TLD: " . $tldInfo->name; echo "Provider: " . $tldInfo->provider; echo "Min Period: " . $tldInfo->minPeriod . " months"; echo "Max Period: " . $tldInfo->maxPeriod . " months"; echo "Grace Period: " . $tldInfo->gracePeriod . " days"; echo "Redemption Period: " . $tldInfo->redemptionPeriod . " days"; echo "Transfer Lock: " . ($tldInfo->transferLock ? 'Yes' : 'No'); echo "Auth Code Required: " . ($tldInfo->authCodeRequired ? 'Yes' : 'No'); echo "DNSSEC: " . ($tldInfo->dnssec ? 'Supported' : 'Not supported'); // Check .nl TLD specifics $nlInfo = $client->tlds->info('nl'); echo "TLD: " . $nlInfo->name; echo "Provider: " . $nlInfo->provider; // Check .eu TLD $euInfo = $client->tlds->info('eu'); echo "TLD: " . $euInfo->name; ``` -------------------------------- ### Renew and Restore Domain with RealtimeRegister PHP Source: https://context7.com/realtimeregister/realtimeregister-php/llms.txt Renew a domain registration for a specified period or restore a domain from redemption grace period. Also includes functionality to delete a domain and get quotes for renewal or restoration. Requires the RealtimeRegister SDK and an API key. ```php domains->renew('example.com', period: 12); echo "New expiry date: " . $newExpiry->format('Y-m-d'); // Get renewal quote $quote = $client->domains->renew('example.com', period: 24, isQuote: true); echo "Renewal cost: " . $quote->price . " " . $quote->currency; // Restore a deleted domain $newExpiry = $client->domains->restore( domain: 'example.com', reason: 'Domain was deleted by mistake' ); echo "Restored! New expiry: " . $newExpiry->format('Y-m-d'); // Get restore quote $quote = $client->domains->restore( domain: 'example.com', reason: 'Restore request', isQuote: true ); echo "Restore cost: " . $quote->price; // Delete a domain $client->domains->delete('example.com'); ``` -------------------------------- ### Initialize Realtime Register PHP Client Source: https://context7.com/realtimeregister/realtimeregister-php/llms.txt Demonstrates how to initialize the RealtimeRegister client with an API key. It also shows optional parameters for specifying a custom API base URL and a PSR-3 logger for enhanced logging capabilities. ```php domains - Domain management // $realtimeRegister->contacts - Contact management // $realtimeRegister->certificates - SSL certificate management // $realtimeRegister->dnszones - DNS zone management // $realtimeRegister->dnstemplates - DNS templates // $realtimeRegister->hosts - Host management // $realtimeRegister->customers - Customer pricing and credits // $realtimeRegister->brands - Brand management // $realtimeRegister->processes - Process management // $realtimeRegister->notifications - Notifications // $realtimeRegister->providers - Registry providers // $realtimeRegister->tlds - TLD information // $realtimeRegister->financial - Financial transactions ``` -------------------------------- ### Customers API: Retrieve Pricing, Promotions, and Credits (PHP) Source: https://context7.com/realtimeregister/realtimeregister-php/llms.txt This snippet demonstrates how to retrieve customer pricing information, upcoming price changes, active promotions, and account credits using the RealtimeRegister PHP SDK. It requires an API key for authentication and takes a customer handle as input. ```php customers->priceList('johndoe', currency: 'EUR'); foreach ($prices->entities as $price) { echo $price->product . ": "; echo "Register: " . $price->register . " "; echo "Renew: " . $price->renew . " "; echo "Transfer: " . $price->transfer; } // Get upcoming price changes $priceChanges = $client->customers->priceChangesList('johndoe'); foreach ($priceChanges->entities as $change) { echo $change->product . " - Effective: " . $change->effectiveDate->format('Y-m-d'); echo " New price: " . $change->newPrice; } // Get active promotions $promos = $client->customers->promoList('johndoe'); foreach ($promos->entities as $promo) { echo $promo->product . ": " . $promo->discount . "% off"; echo " Valid until: " . $promo->endDate->format('Y-m-d'); } // Get account credits $credits = $client->customers->credits('johndoe'); foreach ($credits->entities as $account) { echo $account->currency . ": " . $account->balance; } ``` -------------------------------- ### Use Realtime Register REST API - List Contacts (PHP) Source: https://github.com/realtimeregister/realtimeregister-php/blob/master/README.md Demonstrates how to initialize the RealtimeRegister client with an API key and list contacts for a specific customer using the SDK. ```php contacts->list('johndoe'); ``` -------------------------------- ### Run Code Quality Tools (PHP) Source: https://github.com/realtimeregister/realtimeregister-php/blob/master/README.md Commands to run code quality and testing tools for the PHP project. These include a code style fixer, static analysis, and unit tests. ```bash vendor/bin/php-cs-fixer fix vendor/bin/phpstan analyze vendor/bin/phpunit --coverage-text ``` -------------------------------- ### Perform High-Performance Domain Checks with IsProxy in PHP Source: https://context7.com/realtimeregister/realtimeregister-php/llms.txt This snippet demonstrates how to use the IsProxy interface for efficient bulk domain availability checking with parallel request support. It covers initializing the client, checking single and multiple domains, and enabling premium domain checks. Dependencies include the RealtimeRegister SDK. ```php check('example', 'com'); if ($result !== null) { echo $result->getDomain(); // example.com if ($result->isAvailable()) { echo " is available!"; } else { echo " is not available."; echo " Status: " . $result->getStatus(); } } // Check multiple TLDs at once (efficient parallel checking) $results = $isProxy->checkMany('example', ['com', 'net', 'org', 'io', 'dev']); foreach ($results as $result) { $status = $result->isAvailable() ? 'Available' : 'Taken'; echo $result->getDomain() . ": " . $status . "\n"; } // Output: // example.com: Taken // example.net: Available // example.org: Taken // example.io: Available // example.dev: Available // Enable premium domain checking $isProxy->enable('PREMIUM'); $result = $isProxy->check('premium', 'com'); if ($result !== null) { $extras = $result->getExtras(); if (isset($extras['premium'])) { echo "Premium domain! Price: " . $extras['price']; } } } catch (IsProxyConnectionException $e) { echo "Connection error: " . $e->getMessage(); } ``` -------------------------------- ### Use Realtime Register IsProxy API - Check Domain (PHP) Source: https://github.com/realtimeregister/realtimeregister-php/blob/master/README.md Shows how to initialize the IsProxy client and check the availability of a single domain name. It handles the result to determine if the domain is available. ```php check('example', 'com')) { if ($result->isAvailable()) { echo "{$result->getDomain()} is available."; } else { echo "{$result->getDomain()} is not available."; } } // example.com is available. ``` -------------------------------- ### Brands API: Manage White Label Configuration (PHP) Source: https://context7.com/realtimeregister/realtimeregister-php/llms.txt This PHP snippet illustrates how to manage brand settings for white-label domain registrar services. It covers listing, retrieving, creating, updating, and deleting brands, as well as managing email templates and locales. Authentication requires an API key. ```php brands->list('johndoe', limit: 20); foreach ($brands->entities as $brand) { echo $brand->handle . " - " . $brand->organization; } // Get brand details $brand = $client->brands->get('johndoe', 'mybrand'); echo "Organization: " . $brand->organization; echo "Email: " . $brand->email; // Create a brand $client->brands->create( customer: 'johndoe', handle: 'mybrand', locale: 'en_US', organization: 'My Registrar Inc.', addressLine: ['123 Main Street'], postalCode: '10001', city: 'New York', state: 'NY', country: 'US', email: 'support@myregistrar.com', url: 'https://myregistrar.com', voice: '+1.2125551234', fax: null, privacyContact: 'privacy@myregistrar.com', abuseContact: 'abuse@myregistrar.com', createdDate: new DateTime(), updatedDate: null, hideOptionalTerms: false ); // Update brand $client->brands->update( customer: 'johndoe', handle: 'mybrand', email: 'newsupport@myregistrar.com', url: 'https://new.myregistrar.com' ); // List email templates $templates = $client->brands->listTemplates('johndoe', 'mybrand'); // Get specific template $template = $client->brands->getTemplate('johndoe', 'mybrand', 'DOMAIN_EXPIRY_NOTICE'); echo "Subject: " . $template->subject; // Update template $client->brands->updateTemplate( customer: 'johndoe', brand: 'mybrand', name: 'DOMAIN_EXPIRY_NOTICE', subject: 'Your domain {domain} is expiring soon', html: 'Dear {name}, your domain {domain} expires on {expiryDate}.', text: 'Dear {name}, your domain {domain} expires on {expiryDate}.' ); // Preview template $preview = $client->brands->previewTemplate('johndoe', 'mybrand', 'DOMAIN_EXPIRY_NOTICE'); echo $preview->html; // List available locales $locales = $client->brands->listLocales(); foreach ($locales as $locale) { echo $locale->code . " - " . $locale->name; } // Delete brand $client->brands->delete('johndoe', 'mybrand'); ``` -------------------------------- ### Processes API: Track Async Operations (PHP) Source: https://context7.com/realtimeregister/realtimeregister-php/llms.txt This PHP snippet demonstrates how to monitor and manage asynchronous processes for domain operations, certificate requests, and transfers using the RealtimeRegister SDK. It covers listing processes with filters, retrieving details, resending notifications, deleting processes, and exporting process data. An API key is required for authentication. ```php processes->list( limit: 50, parameters: ['status' => 'PENDING'] ); foreach ($processes->entities as $process) { echo "ID: " . $process->id; echo " Type: " . $process->type; echo " Status: " . $process->status; echo " Created: " . $process->createdDate->format('Y-m-d H:i:s'); } // Get process details $process = $client->processes->get(12345); echo "Process ID: " . $process->id; echo "Type: " . $process->type; echo "Status: " . $process->status; echo "Identifier: " . $process->identifier; // Get extended process info $info = $client->processes->info(12345); echo "Details: " . json_encode($info->toArray()); // Resend process notifications (e.g., transfer approval email) $client->processes->resend(12345); // Cancel/delete a process $client->processes->delete(12345); // Export processes $exported = $client->processes->export(['type' => 'TRANSFER']); ``` -------------------------------- ### Use Realtime Register IsProxy API - Check Multiple Domains (PHP) Source: https://github.com/realtimeregister/realtimeregister-php/blob/master/README.md Demonstrates checking the availability of multiple domain names simultaneously using the IsProxy interface. It iterates through the results and indicates availability for each. ```php checkMany('example', ['nl', 'com', 'net', 'org']) as $result) { echo $result->getDomain() . $result->isAvailable() ? ' ✅' : ' ❌'; } // example.nl ✅ // example.com ❌ // example.net ✅ // example.org ✅ ``` -------------------------------- ### Manage DNS Templates with RealtimeRegister PHP API Source: https://context7.com/realtimeregister/realtimeregister-php/llms.txt This snippet shows how to create and manage DNS templates using the RealtimeRegister PHP client. It covers listing, retrieving, creating, updating, and deleting templates, which are useful for consistent zone configurations across multiple domains. Requires the RealtimeRegister PHP SDK. ```php dnstemplates->list('johndoe', limit: 20); foreach ($templates->entities as $template) { echo $template->name . " - TTL: " . $template->ttl; } // Get template details $template = $client->dnstemplates->get('johndoe', 'standard-web'); // Create DNS template $records = DomainZoneRecordCollection::fromArray([ ['name' => '@', 'type' => 'A', 'content' => '{IP}', 'ttl' => 3600], ['name' => 'www', 'type' => 'CNAME', 'content' => '@', 'ttl' => 3600], ['name' => '@', 'type' => 'MX', 'content' => 'mail.{DOMAIN}', 'prio' => 10, 'ttl' => 3600], ['name' => '@', 'type' => 'TXT', 'content' => 'v=spf1 include:_spf.provider.com ~all', 'ttl' => 3600], ]); $client->dnstemplates->create( customer: 'johndoe', name: 'standard-web', hostMaster: 'hostmaster@{DOMAIN}', refresh: 10800, retry: 3600, expire: 604800, ttl: 3600, records: $records ); // Update template $client->dnstemplates->update( customer: 'johndoe', name: 'standard-web', hostMaster: 'admin@yourdomain.com', refresh: 10800, retry: 3600, expire: 604800, ttl: 7200 ); // Delete template $client->dnstemplates->delete('johndoe', 'standard-web'); ``` -------------------------------- ### Manage SSL Certificates using PHP Source: https://context7.com/realtimeregister/realtimeregister-php/llms.txt Perform various management operations on SSL certificates, including listing, downloading in different formats, renewing, reissuing, revoking, scheduling validation calls, retrieving process information, decoding CSRs, and importing existing certificates. ```php certificates->listCertificates(limit: 50); foreach ($certificates->entities as $cert) { echo $cert->commonName . " - Expires: " . $cert->expiryDate->format('Y-m-d'); } // Get certificate details $certificate = $client->certificates->getCertificate(12345); echo "Common Name: " . $certificate->commonName; echo "Status: " . $certificate->status; echo "Issuer: " . $certificate->issuer; // Download certificate in various formats $certPem = $client->certificates->downloadCertificate(12345, 'CRT'); $certPkcs7 = $client->certificates->downloadCertificate(12345, 'PKCS7'); file_put_contents('certificate.pem', $certPem); // Renew certificate $csr = "-----BEGIN CERTIFICATE REQUEST-----\n...\n-----END CERTIFICATE REQUEST-----"; $process = $client->certificates->renewCertificate( certificateId: 12345, period: 12, csr: $csr ); // Reissue certificate (e.g., after key compromise or adding SANs) $process = $client->certificates->reissueCertificate( certificateId: 12345, csr: $newCsr, san: ['www.example.com', 'api.example.com'] ); // Revoke certificate $client->certificates->revokeCertificate(12345, reason: 'Key compromise'); // Schedule validation call for OV/EV certificates $client->certificates->scheduleValidationCall( processId: 67890, date: new DateTimeImmutable('2024-03-15 14:00:00') ); // Get certificate process info $info = $client->certificates->info(67890); echo "Status: " . $info->status; // Decode CSR to verify contents $decoded = $client->certificates->decodeCsr($csr); echo "Common Name: " . $decoded['commonName']; echo "Organization: " . $decoded['organization']; // Import existing certificate $client->certificates->importCertificate( customer: 'johndoe', certificate: $certificatePem, csr: $csr, domainName: 'example.com' ); ``` -------------------------------- ### Check Domain Availability with Realtime Register PHP SDK Source: https://context7.com/realtimeregister/realtimeregister-php/llms.txt This PHP code snippet illustrates how to check the availability of a domain name using the Realtime Register PHP SDK. It also shows how to check IDN (Internationalized Domain Names) with a specified language code and access details like price and premium status. ```php domains->check('example.com'); if ($availability->available) { echo "Domain is available!"; echo "Price: " . $availability->price; echo "Premium: " . ($availability->premium ? 'Yes' : 'No'); } else { echo "Domain is not available"; } // Check IDN domain with language code $availability = $client->domains->check('beispiel.de', 'de'); ``` -------------------------------- ### Create Contact Records with PHP Source: https://context7.com/realtimeregister/realtimeregister-php/llms.txt Create new contact records for domains using the RealtimeRegister PHP SDK. Supports creating standard contacts and GDPR compliant contacts by specifying disclosed fields. ```php contacts->create( customer: 'johndoe', handle: 'contact-001', name: 'John Doe', addressLine: ['123 Main Street', 'Suite 100'], postalCode: '10001', city: 'New York', country: 'US', email: 'john@example.com', voice: '+1.2125551234', organization: 'ACME Inc.', state: 'NY', fax: '+1.2125551235' ); // Create contact with disclosed fields (GDPR compliant) $client->contacts->create( customer: 'johndoe', handle: 'contact-002', name: 'Jane Doe', addressLine: ['456 Oak Avenue'], postalCode: '90210', city: 'Beverly Hills', country: 'US', email: 'jane@example.com', voice: '+1.3105551234', disclosedFields: ['NAME', 'EMAIL', 'ORGANIZATION'] ); ?> ``` -------------------------------- ### Manage DNS Zone Records with PHP Source: https://context7.com/realtimeregister/realtimeregister-php/llms.txt Retrieve and update DNS zone records for a domain using the RealtimeRegister PHP SDK. This involves fetching existing zone data and then applying new records, including A, CNAME, MX, and TXT types. ```php domains->zone('example.com'); echo "Host Master: " . $zone->hostMaster; echo "TTL: " . $zone->ttl; echo "Refresh: " . $zone->refresh; foreach ($zone->records as $record) { echo $record->name . " " . $record->type . " " . $record->content; } // Update DNS zone with new records $records = DomainZoneRecordCollection::fromArray([ ['name' => '@', 'type' => 'A', 'content' => '192.168.1.1', 'ttl' => 3600], ['name' => 'www', 'type' => 'CNAME', 'content' => '@', 'ttl' => 3600], ['name' => '@', 'type' => 'MX', 'content' => 'mail.example.com', 'prio' => 10, 'ttl' => 3600], ['name' => '@', 'type' => 'TXT', 'content' => 'v=spf1 include:_spf.google.com ~all', 'ttl' => 3600], ]); $client->domains->zoneUpdate( domainName: 'example.com', hostMaster: 'hostmaster@example.com', refresh: 10800, retry: 3600, expire: 604800, ttl: 3600, records: $records ); ?> ``` -------------------------------- ### Track Financial Transactions and Exchange Rates with RealtimeRegister PHP SDK Source: https://context7.com/realtimeregister/realtimeregister-php/llms.txt Track financial transactions and retrieve current exchange rates using the RealtimeRegister PHP SDK. This includes listing transactions with filters, retrieving specific transaction details, fetching exchange rates for a base currency, and exporting transaction data. ```php financial->listTransactions( limit: 50, offset: 0, parameters: ['currency' => 'EUR'] ); foreach ($transactions->entities as $tx) { echo "ID: " . $tx->id; echo " Date: " . $tx->date->format('Y-m-d'); echo " Amount: " . $tx->amount . " " . $tx->currency; echo " Type: " . $tx->type; echo " Description: " . $tx->description; } // Get specific transaction $transaction = $client->financial->getTransaction(12345); echo "Transaction ID: " . $transaction->id; echo "Amount: " . $transaction->amount; echo "Currency: " . $transaction->currency; // Get exchange rates $rates = $client->financial->exchangeRates('USD'); echo "Base currency: " . $rates->baseCurrency; foreach ($rates->rates as $currency => $rate) { echo $currency . ": " . $rate; } // Export transactions $exported = $client->financial->export(['startDate' => '2024-01-01', 'endDate' => '2024-12-31']); ``` -------------------------------- ### Handle API Errors and Exceptions in PHP with RealtimeRegister SDK Source: https://context7.com/realtimeregister/realtimeregister-php/llms.txt This snippet demonstrates robust error handling for API operations using the RealtimeRegister PHP SDK. It covers catching specific exceptions like UnauthorizedException, NotFoundException, ForbiddenException, BadRequestException, InvalidArgumentException, and general GuzzleExceptions for network errors. It also shows error handling for domain registration failures. ```php domains->get('example.com'); } catch (UnauthorizedException $e) { // Invalid API key or unauthorized access echo "Authentication failed: " . $e->getMessage(); } catch (NotFoundException $e) { // Domain not found echo "Domain not found: " . $e->getMessage(); } catch (ForbiddenException $e) { // Access denied to resource echo "Access forbidden: " . $e->getMessage(); } catch (BadRequestException $e) { // Invalid request parameters echo "Bad request: " . $e->getMessage(); } catch (InvalidArgumentException $e) { // Invalid argument passed to SDK method echo "Invalid argument: " . $e->getMessage(); } catch (GuzzleException $e) { // Network or HTTP error echo "HTTP error: " . $e->getMessage(); } // Domain registration with error handling try { $registration = $client->domains->register( domainName: 'example.com', customer: 'johndoe', registrant: 'contact-handle' ); echo "Domain registered successfully!"; } catch (BadRequestException $e) { // Domain already registered, invalid parameters, etc. echo "Registration failed: " . $e->getMessage(); } ``` -------------------------------- ### Validate, Split, and Manage Contact Properties with PHP Source: https://context7.com/realtimeregister/realtimeregister-php/llms.txt Perform advanced contact management tasks with the RealtimeRegister PHP SDK, including validating contacts for specific registries, splitting contacts, adding/updating registry-specific properties, and listing/getting country information. ```php contacts->validate( customer: 'johndoe', handle: 'contact-001', categories: ['General', 'Nominet', 'DkHostmaster'] ); // Split a contact (create a copy for specific registries) $client->contacts->split( customer: 'johndoe', handle: 'contact-001', newHandle: 'contact-001-split', registries: ['SIDN', 'EURid'] ); // Add registry-specific properties $client->contacts->addProperties( customer: 'johndoe', handle: 'contact-001', registry: 'SIDN', properties: [ 'legalForm' => 'PERSOON', 'legalFormRegistrationNumber' => '12345678' ], intendedUsage: 'REGISTRANT' ); // Update registry properties $client->contacts->updateProperties( customer: 'johndoe', handle: 'contact-001', registry: 'EURid', properties: ['vat' => 'BE0123456789'] ); // List countries $countries = $client->contacts->listCountries(); foreach ($countries->entities as $country) { echo $country->code . " - " . $country->name; } // Get country details $country = $client->contacts->getCountry('US'); echo "Country: " . $country->name; ?> ``` -------------------------------- ### Update Domain Settings with RealtimeRegister PHP Source: https://context7.com/realtimeregister/realtimeregister-php/llms.txt Update domain settings including nameservers, contacts, privacy protection, auto-renewal, and DNSSEC configuration. Requires the RealtimeRegister SDK and an API key. ```php domains->update( domainName: 'example.com', ns: ['ns1.newdns.com', 'ns2.newdns.com'] ); // Update privacy protection and auto-renewal $client->domains->update( domainName: 'example.com', privacyProtect: true, autoRenew: false ); // Update registrant contact $client->domains->update( domainName: 'example.com', registrant: 'new-registrant-handle' ); // Update with domain statuses (client locks) $client->domains->update( domainName: 'example.com', statuses: ['clientTransferProhibited', 'clientDeleteProhibited'] ); // Get update quote $quote = $client->domains->update( domainName: 'example.com', registrant: 'new-registrant-handle', isQuote: true ); echo "Update cost: " . $quote->price; ``` -------------------------------- ### Request SSL Certificate using PHP Source: https://context7.com/realtimeregister/realtimeregister-php/llms.txt Request a new SSL certificate by providing a Certificate Signing Request (CSR), customer information, and domain validation method. This function supports requesting certificates with or without Subject Alternative Names (SANs). ```php certificates->listProducts(limit: 20); foreach ($products->entities as $product) { echo $product->name . " - " . $product->brand; } // Get product details $product = $client->certificates->getProduct('comodo-positivessl'); // Get DCV email addresses for domain $emails = $client->certificates->listDcvEmailAddresses('example.com', 'comodo-positivessl'); // Returns: ['admin@example.com', 'administrator@example.com', 'webmaster@example.com', ...] // Request SSL certificate $csr = "-----BEGIN CERTIFICATE REQUEST-----\n...\n-----END CERTIFICATE REQUEST-----"; $process = $client->certificates->requestCertificate( customer: 'johndoe', product: 'comodo-positivessl', period: 12, // months csr: $csr, organization: 'ACME Inc.', address: '123 Main Street', postalCode: '10001', city: 'New York', country: 'US', dcv: [ ['commonName' => 'example.com', 'type' => 'EMAIL', 'email' => 'admin@example.com'] ] ); echo "Process ID: " . $process->processId; echo "Status: " . $process->status; // Request with Subject Alternative Names (SAN) $process = $client->certificates->requestCertificate( customer: 'johndoe', product: 'comodo-positivessl-multi', period: 12, csr: $csr, san: ['www.example.com', 'mail.example.com', 'api.example.com'], organization: 'ACME Inc.', city: 'New York', country: 'US' ); ```