david-garcia/phpwhois
PHP WHOIS lookup library for querying domain registration data across TLDs. Parse registrar, creation and expiry dates, nameservers, and status directly from WHOIS servers using a simple PHP API.
Architecture fit — poor as a Laravel component, acceptable as a raw PHP dependency. This is not a Laravel package: no service provider, no facade, no config/ publishing, no extra.laravel auto-discovery. It is a framework-agnostic Composer library of per-TLD handler classes (WhoisHandler, WhoisParser, socket client) that must be instantiated manually. Any use in our app requires us to author the container binding, configuration surface, and adapter ourselves.
Integration feasibility — mechanically easy, production-readiness is the real question. composer require works; instantiation is a few lines. But the library performs synchronous, blocking TCP/43 socket I/O via fsockopen/sockets — it does not use Guzzle or Laravel's HTTP client, which means we lose Http::fake(), middleware, retry policy, proxy config, and per-request timeout governance. Every call must be pushed into a queued job by us.
Technical risk — several, in descending severity:
null fields rather than erroring — the worst failure class for data consumers.Key questions for the technical spike:
Stack fit. Composer/PSR-4 library loads into Laravel 8–11 without conflict risk — precisely because it has no framework coupling and almost no dependency tree. That same thinness is why we own the integration layer entirely. Confirm ext-sockets/ext-filter/ext-ctype availability in our runtime image before committing.
Migration path — adopt behind an interface, never call it directly. Define a DomainLookupService contract in our domain layer with a driver-based implementation (rdap, whois, commercial_api). Bind the driver via config and the container. This makes the library a swappable leaf dependency rather than an ambient dependency, and lets us add RDAP-first/WHOIS-fallback routing without touching call sites. Given the repo is small and the license is GPL-2.0, an internal fork under our own namespace is plausible — but a fork inherits the license, so it does not resolve the distribution question.
Compatibility. Pin an exact version and lock it; there will be no upstream patch stream, so a pin is a durable decision, not a temporary one. Audit the handler directory for hardcoded server names/ports before trusting it. Verify behavior on IDN/punycode input, which is a common parser blind spot.
Sequencing:
Maintenance — the dominant cost, and it is ours. Upstream is effectively dormant: one release, 2021, one star, zero dependents. We inherit the per-TLD handler table, which is a perpetually drifting artifact as registries change formats and new TLDs delegate. Budget a fractional engineer per quarter for handler repair plus one-off work for each PHP major/minor bump. Treat this as a decaying asset in the roadmap, not a stable dependency.
Support. No community, no issue triage, no CVE feed. Internal ownership is mandatory: one named engineer, one runbook, documented fallback behavior for "no parser for this TLD." Without that, the first registry change becomes an unowned incident.
Scaling — the primary architectural constraint. Synchronous socket calls consume a PHP-FPM worker for 0.5–3s per lookup, plus referral hops. All lookups must run on Horizon/queue workers with per-registry concurrency caps, exponential backoff, and aggressive response caching (WHOIS data changes on the order of days, not seconds). No batching or connection reuse; each query and each referral is a fresh connection. Throughput scales by adding workers, not by optimizing the library.
Failure modes to design for explicitly:
Ramp-up. Basic usage is hours. Production-hardened usage is roughly 1–2 weeks of engineering across the sequencing above, plus counsel time, plus ongoing handler maintenance. That is a large multiple of the effort implied by "composer require a WHOIS library," and it should be scoped against the alternative of a paid API that absorbs protocol churn, rate limits, and parser maintenance entirely.
Recommendation. Do not adopt as a primary dependency. Use it at most as a narrow WHOIS fallback behind an RDAP-first interface, contingent on a clean license review and a spike that proves outbound port 43 plus acceptable top-20-TLD coverage. If either gate fails, replace with a commercial WHOIS/RDAP API and treat this repo as a reference implementation only.
How can I help you explore Laravel packages today?