PHP code example of otghcloud / laravel-whois
1. Go to this page and download the library: Download otghcloud/laravel-whois library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
otghcloud / laravel-whois example snippets
return [
'cache' => [
'enabled' => true,
'ttl' => 3600,
],
'timeout_whois' => 15,
'timeout_rdap' => 15,
'retry_attempts' => 3,
'retry_backoff' => [2, 10, 30],
'lookup_mode' => 'safe', // 'safe' or 'strict'
'default_sources' => ['rdap', 'whois'],
];
$result = whois('example.com');
= OTGH\LaravelWhois\Parsers\ParsedResult {#9061
+domain: "example.com",
+registered: true,
+registrar: "RESERVED-Internet Assigned Numbers Authority",
+registrarURL: null,
+createdAt: Carbon\Carbon @808372800 {#9049
date: 1995-08-14 04:00:00.0 +00:00,
},
+updatedAt: Carbon\Carbon @1768588010 {#9060
date: 2026-01-16 18:26:50.0 +00:00,
},
+expiresAt: Carbon\Carbon @1786593600 {#9058
date: 2026-08-13 04:00:00.0 +00:00,
},
+status: [
"client delete prohibited",
"client transfer prohibited",
"client update prohibited",
],
+nameServers: [
"elliott.ns.cloudflare.com",
"hera.ns.cloudflare.com",
],
+ageSeconds: 0,
+remainingSeconds: 0,
+grace: false,
+redemption: false,
+pendingDelete: false,
+unknown: [],
+rawResponse: "", // Ommited for brevity - returns the raw RDAP/WHOIS data in JSON format
+source: "rdap",
+servedFromCache: true,
+errors: [],
}
// By default, results are cached after the first lookup.
// To bypass cache, pass ignoreCache in the options array:
$result = whois('example.com', ['ignoreCache' => true]);
use OTGH\LaravelWhois\Facades\LaravelWhois;
$result = LaravelWhois::lookup('example.com');
dump($result);
// Same as above, bypassing the cache
$freshResult = LaravelWhois::lookup('example.com', ['ignoreCache' => true]);
echo $result->domain;
echo $result->registrar;
echo $result->expiresAt?->toDateString();
// Convenience methods
$result->fetchDates();
$result->isExpired();
$result->isRegistered();
$result->daysUntilExpiry();
$result->toArray();
$result->toJson();
bash
php artisan vendor:publish --tag="laravel-whois-config"