PHPackages                             labrodev/laravel-domain-verifier - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. labrodev/laravel-domain-verifier

ActiveLibrary

labrodev/laravel-domain-verifier
================================

DNS-over-HTTPS TXT/CNAME resolver for Laravel with token-based domain-ownership verification.

v1.0.0(yesterday)08↑2525%MITPHP ^8.4

Since Jul 22Compare

[ Source](https://github.com/labrodev/laravel-domain-verifier)[ Packagist](https://packagist.org/packages/labrodev/laravel-domain-verifier)[ Docs](https://github.com/labrodev/laravel-domain-verifier)[ RSS](/packages/labrodev-laravel-domain-verifier/feed)WikiDiscussions Synced today

READMEChangelogDependencies (9)Versions (2)Used By (0)

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
------------

[](#installation)

```
composer require labrodev/laravel-domain-verifier
```

Publish the config file:

```
php artisan vendor:publish --tag=domain-verifier-config
```

Set the environment variables (all optional — the defaults are sensible):

```
DOMAIN_VERIFIER_DOH_RESOLVERS=https://dns.google/resolve,https://cloudflare-dns.com/dns-query
DOMAIN_VERIFIER_TXT_PREFIX=domain-verify=
DOMAIN_VERIFIER_TOKEN_LENGTH=48
DOMAIN_VERIFIER_HTTP_TIMEOUT=5
```

Verifying domain ownership
--------------------------

[](#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:

```
use Labrodev\DomainVerifier\Services\VerificationTokenGenerator;

$token = (new VerificationTokenGenerator)();
```

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`:

```
use Labrodev\DomainVerifier\Services\DnsResolver;
use Labrodev\DomainVerifier\Services\OwnerVerifier;

$ownerVerifier = new OwnerVerifier(new DnsResolver);

// "Add a TXT record on @ with this value:"
$ownerVerifier->expectedRecord($token); // "domain-verify={token}"
```

Later — from a button, a scheduled job, whatever fits — check whether the record is live. Invoking the verifier returns a bare boolean:

```
if ($ownerVerifier('example.com', $token)) {
    // mark the domain as verified
}
```

Use `verify()` when you want to show the user why verification failed:

```
$result = $ownerVerifier->verify('example.com', $token);

$result->verified;        // bool
$result->expected;        // the TXT value that was looked for
$result->observedRecords; // every TXT record actually found on the domain
```

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
-------------------------------------

[](#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:

```
use Labrodev\DomainVerifier\Services\CnameVerifier;
use Labrodev\DomainVerifier\Services\DnsResolver;

$cnameVerifier = new CnameVerifier(new DnsResolver);

if ($cnameVerifier('status.example.com', 'pages.my-platform.dev')) {
    // the CNAME is in place
}
```

Raw DNS lookups
---------------

[](#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:

```
use Labrodev\DomainVerifier\Services\DnsResolver;

$dnsResolver = new DnsResolver;

$dnsResolver->txtRecords('example.com');          // list, quotes and chunking normalized
$dnsResolver->cnameRecords('status.example.com'); // list, trailing dots stripped
```

Why DNS-over-HTTPS
------------------

[](#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
-------

[](#testing)

```
composer test      # pest
composer phpstan   # larastan, level 7
composer pint      # laravel preset
composer check     # all of the above
```

License
-------

[](#license)

MIT. See [LICENSE.md](LICENSE.md).

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance100

Actively maintained with recent releases

Popularity7

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/151143718?v=4)[Lashyn Petro ](/maintainers/labrodev)[@labrodev](https://github.com/labrodev)

---

Tags

laraveldnsdomainverificationdohlabrodev

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/labrodev-laravel-domain-verifier/health.svg)

```
[![Health](https://phpackages.com/badges/labrodev-laravel-domain-verifier/health.svg)](https://phpackages.com/packages/labrodev-laravel-domain-verifier)
```

###  Alternatives

[simplestats-io/laravel-client

Server-side analytics for Laravel that follows the full funnel from visit to registration to payment, attributed to the channel that drove it. Revenue, MRR, churn and ad-spend profit (ROAS/CAC) per channel. GDPR compliant, ad-blocker proof.

5022.6k](/packages/simplestats-io-laravel-client)[defstudio/telegraph

A laravel facade to interact with Telegram Bots

813336.8k3](/packages/defstudio-telegraph)[psalm/plugin-laravel

Psalm plugin for Laravel

3345.3M347](/packages/psalm-plugin-laravel)[spatie/laravel-export

Create a static site bundle from a Laravel app

674146.0k6](/packages/spatie-laravel-export)[api-platform/laravel

API Platform support for Laravel

58174.6k17](/packages/api-platform-laravel)[fleetbase/core-api

Core Framework and Resources for Fleetbase API

1235.9k21](/packages/fleetbase-core-api)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
