Download the PHP package labrodev/laravel-domain-verifier without Composer
On this page you can find all versions of the php package labrodev/laravel-domain-verifier. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download labrodev/laravel-domain-verifier
More information about labrodev/laravel-domain-verifier
Files in labrodev/laravel-domain-verifier
Package laravel-domain-verifier
Short Description DNS-over-HTTPS TXT/CNAME resolver for Laravel with token-based domain-ownership verification.
License MIT
Homepage https://github.com/labrodev/laravel-domain-verifier
Informations about the package laravel-domain-verifier
Laravel Domain Verifier
DNS-over-HTTPS TXT/CNAME resolver for Laravel with token-based domain-ownership verification. Generate a token, tell the user which TXT record to publish, and check for it later — every lookup goes over plain HTTPS to a configurable list of DoH resolvers, so it works reliably inside Docker and is trivial to fake in tests.
Installation
Publish the config file:
Set the environment variables (all optional — the defaults are sensible):
Verifying domain ownership
Generate a token when the user registers their domain, and store it alongside the domain. VerificationTokenGenerator is a single-purpose service — invoke it directly rather than calling a named method:
Show the user the exact record to publish. expectedRecord() is the single source of truth for the record value — it prepends the configured txt_prefix:
Later — from a button, a scheduled job, whatever fits — check whether the record is live. Invoking the verifier returns a bare boolean:
Use verify() when you want to show the user why verification failed:
The match is strict and whole-string: a token embedded inside a longer record does not verify, and every mismatch is logged as a warning with the expected and observed values.
Verifying a CNAME points at your host
CnameVerifier checks that a hostname CNAMEs to a target you pass explicitly — for instance before routing a custom domain or issuing a certificate. Trailing dots are normalised on both sides:
Raw DNS lookups
DnsResolver is also useful on its own — for instance to check that a CNAME points at your platform before issuing a certificate:
Why DNS-over-HTTPS
PHP's dns_get_record() is unreliable inside Docker: the embedded resolver at 127.0.0.11 frequently returns false for TXT lookups. DoH is plain outbound HTTPS, so it works from inside containers and can be faked with Http::fake() in tests. The configured resolvers are tried in order; the system resolver is only consulted when every one of them is unreachable.
Testing
License
MIT. See LICENSE.md.
All versions of laravel-domain-verifier with dependencies
guzzlehttp/guzzle Version ^7.8
illuminate/http Version ^13.0
illuminate/support Version ^13.0
spatie/laravel-package-tools Version ^1.16