monovm / whois-laravel
Simple and fast domain whois lookup and availability checking for Laravel with a facade, config, caching and an artisan command.
Requires
- php: ^8.0
- ext-json: *
- illuminate/console: ^8.0 || ^9.0 || ^10.0 || ^11.0 || ^12.0
- illuminate/contracts: ^8.0 || ^9.0 || ^10.0 || ^11.0 || ^12.0
- illuminate/support: ^8.0 || ^9.0 || ^10.0 || ^11.0 || ^12.0
- monovm/whois-php: ^1.3
Requires (Dev)
- orchestra/testbench: ^6.25 || ^7.0 || ^8.0 || ^9.0 || ^10.0
- phpunit/phpunit: ^9.5.10 || ^10.5 || ^11.0
- squizlabs/php_codesniffer: ^3.7
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is not auto-updated.
Last update: 2026-10-19 11:21:16 UTC
README
Retrieve domain registration information and check domain availability via socket protocol โ with a facade, publishable config, optional result caching and an artisan command.
๐ฆ Requirements
- PHP 8.0 or higher
- Laravel 8, 9, 10, 11 or 12
๐ Installation
You can install the package via composer:
composer require monovm/whois-laravel
The service provider and the Whois facade are registered automatically via package discovery.
Optionally publish the config file:
php artisan vendor:publish --tag=whois-config
๐ Usage/Examples
Checking availability
Whois::check() returns an associative array with domains as keys and statuses as values.
Current statuses: available, unavailable, premium, invalid, unknown.
use MonoVM\WhoisLaravel\Facades\Whois; // Single domain $result1 = Whois::check('monovm.com'); // ['monovm.com' => 'unavailable'] // Single domain without specifying TLD โ popular TLDs from the config are looked up $result2 = Whois::check('monovm'); // ['monovm.com' => 'unavailable', 'monovm.net' => 'unavailable', 'monovm.org' => 'unavailable', 'monovm.info' => 'unavailable'] // Multiple domains $result3 = Whois::check(['monovm', 'google.com', 'bing']); // Custom popular TLDs for this call only $result4 = Whois::check('monovm', ['popularTLDs' => ['.io', '.dev']]);
Full whois lookup
Whois::lookup() runs a full whois lookup for a single domain and returns a WhoisResult DTO:
use MonoVM\WhoisLaravel\Facades\Whois; $result = Whois::lookup('monovm.com'); $result->domain; // "monovm.com" $result->sld; // "monovm" $result->tld; // ".com" $result->valid; // true โ the domain can be looked up $result->available; // false โ availability via enhanced detection $result->message; // the whois server message $result->toArray(); // array representation, also JsonSerializable
Shortcuts
use MonoVM\WhoisLaravel\Facades\Whois; // Availability as a boolean if (Whois::isAvailable('monovm.com')) { // ... } // Raw whois handler (never cached) $handler = Whois::handler('monovm.com'); $handler->getAvailabilityDetails(); // debug info about the availability detection
Dependency injection
Prefer injection over the facade? Type-hint the service:
use MonoVM\WhoisLaravel\WhoisService; public function __invoke(WhoisService $whois) { $status = $whois->check('monovm.com'); }
๐ฅ Artisan command
php artisan whois:lookup monovm.com google.com # +------------+-------------+ # | Domain | Status | # +------------+-------------+ # | monovm.com | unavailable | # | google.com | premium | # +------------+-------------+ php artisan whois:lookup monovm.com --json # { # "monovm.com": "unavailable" # }
โ๏ธ Configuration
config/whois.php:
return [ // Looked up when a domain is checked without a TLD (eg: "monovm") 'popular_tlds' => ['.com', '.net', '.org', '.info'], // Whois servers rate-limit aggressively; enable caching to serve // repeated lookups for the same domain from the cache. 'cache' => [ 'enabled' => env('WHOIS_CACHE_ENABLED', false), 'store' => env('WHOIS_CACHE_STORE'), // null = default cache store 'ttl' => env('WHOIS_CACHE_TTL', 300), // seconds 'prefix' => 'whois:', ], ];
Caching applies to check() and lookup(). handler() always performs a live lookup.
๐งช Testing
composer test
The package ships a MonoVM\WhoisLaravel\Contracts\Client binding you can swap in your own tests to avoid
real network lookups:
$this->app->instance(\MonoVM\WhoisLaravel\Contracts\Client::class, $yourFakeClient);
๐ Contributing
If you want to extend functionality or correct a bug, feel free to create a new pull request at Github's repository.
โ๏ธ License
๐ป Support
For support, email dev@monovm.com.