- How do I install spatie/laravel-rdap in a Laravel application?
- Install it with Composer by running composer require spatie/laravel-rdap. The service provider is auto-discovered, so no manual registration is needed. If you want to change cache stores, durations, timeouts, or retry behaviour, publish the config file with php artisan vendor:publish --tag="rdap-config". There are no migrations, assets, or queue workers to set up.
- Which Laravel and PHP versions does spatie/laravel-rdap support?
- The package tracks current framework releases, with Laravel 12 support added in 1.1.1 and Laravel 13 compatibility added in 1.4.0. A PHP 8.4 deprecation fix landed in 1.1.2. As with any Composer dependency, check the version constraints on Packagist against the Laravel and PHP versions your application actually runs before upgrading.
- How do I perform a domain lookup with RDAP in Laravel?
- Resolve the Rdap facade and call domain() with the domain name, for example Rdap::domain('spatie.be'). You get back a typed DomainResponse object built from the standardized JSON returned by the registry. Because the payload is structured, you read values such as events by key instead of parsing WHOIS text. The package also exposes domainIsSupported() so you can check TLD support before querying.
- How does caching work and can I use my own cache store?
- Caching is enabled out of the box for both RDAP responses and the TLD server URL lookups. The published rdap.php config has a tld_servers_cache block where you set store_name (null uses your application's default cache store) and duration_in_seconds, which defaults to one week. Pointing store_name at a specific cache store is useful when you want RDAP lookups isolated from the rest of your cache.
- Which TLDs are supported, and what happens if a TLD is not supported?
- Coverage comes from the IANA bootstrap plus a bundled table of 54 TLD server entries and a configurable additional_tld_servers map added in 1.5.0. For TLDs outside that set, getServerForDomain() returns null. Call domainIsSupported() first if you need to distinguish an unsupported TLD from a domain that simply does not exist. Treat the bundled server list as a snapshot that can go stale and override entries in config when a registry moves.
- How do I configure timeouts and retries for unreliable RDAP endpoints?
- The domain_queries block in rdap.php controls this. timeout_in_seconds sets the per-attempt wait (5 seconds by default), and the retry settings control how many attempts are made before giving up. RDAP endpoints can be slow or intermittently unavailable, so keeping a small retry count with a short timeout is usually better than one long timeout. All failures surface as RdapException, so a single catch block can handle them.
- Why does Rdap::domain() return null, and how do I tell a missing domain from an unsupported TLD?
- Both cases can return null, which is the package's main correctness hazard. A null from domain() may mean the domain is not registered, and a null from getServerForDomain() means the TLD has no known RDAP server. Disambiguate by calling domainIsSupported() for the TLD before treating a null as a definitive not-found answer. Version 1.5.0 fixed null being returned for missing domains when only one query attempt was configured, so keep the package current.
- Can I look up IP addresses and DNS information with this package?
- Yes. Alongside domain queries, the package resolves RDAP servers for IP addresses and DNS via RdapIpV4 and RdapDns, returning typed IpResponse objects. This is handy for IP-to-registry attribution in logs and fraud rules, alongside the more common domain expiry and ownership checks. The same caching and HTTP configuration applies to these query paths.
- How do I test RDAP queries without hitting real registry endpoints?
- The package uses Laravel's HTTP client, so Http::fake() in your test suite intercepts the bootstrap and RDAP requests and lets you return fixture JSON. Combine that with a cache fake or an in-memory cache store so TLD server lookups do not persist between tests. There is no dedicated fake client in the package, so assert on the typed response objects or on exceptions of type RdapException. Avoid real network calls in CI, since third-party registry availability is the dominant failure mode.
- Is spatie/laravel-rdap a good alternative to WHOIS packages?
- Yes, mainly because RDAP returns standardized JSON instead of free-form text, so downstream code depends on stable keys rather than parser quirks. The trade-offs are that not every TLD has RDAP coverage, and the majority of TLDs still depend on the live IANA bootstrap being reachable. The bundled TLD table plus additional_tld_servers reduces but does not remove that dependency, and the bundled snapshot has no automatic refresh, so plan to maintain overrides yourself.