PHPackages                             cboxdk/laravel-dns - 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. cboxdk/laravel-dns

ActiveLibrary

cboxdk/laravel-dns
==================

Laravel integration for cboxdk/dns — authoritative DNS lookups, domain-ownership verification, DNSSEC validation, and intoDNS/MxToolbox-style diagnostics via a facade, Artisan commands, and validation rules.

v0.1.0(1mo ago)4808↑112.5%MITPHPPHP ^8.4CI failing

Since Jul 15Pushed 1mo agoCompare

[ Source](https://github.com/cboxdk/laravel-dns)[ Packagist](https://packagist.org/packages/cboxdk/laravel-dns)[ Docs](https://github.com/cboxdk/laravel-dns)[ RSS](/packages/cboxdk-laravel-dns/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (1)Dependencies (9)Versions (2)Used By (0)

Cbox DNS
========

[](#cbox-dns)

[![Latest Version on Packagist](https://camo.githubusercontent.com/4e322f1e4b9516c84209dcb7b6b4b35183f68dbc8cd43b32de89fb38dde4d972/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f63626f78646b2f6c61726176656c2d646e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/cboxdk/laravel-dns)[![Total Downloads](https://camo.githubusercontent.com/059b397da522cc6b494cad6e077c8cb22f82b693b3ec5cf8e487cac57ec2d597/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f63626f78646b2f6c61726176656c2d646e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/cboxdk/laravel-dns)[![PHP Version](https://camo.githubusercontent.com/b983458072bf6ee56afed661f5908a3100a91d07531ef850dfa07aa6da32c3c3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f63626f78646b2f6c61726176656c2d646e733f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/b983458072bf6ee56afed661f5908a3100a91d07531ef850dfa07aa6da32c3c3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f63626f78646b2f6c61726176656c2d646e733f7374796c653d666c61742d737175617265)

The DNS toolkit for Laravel: authoritative lookups, domain-ownership verification, DNSSEC validation, and intoDNS/MxToolbox-style diagnostics — exposed through a facade, Artisan commands, and validation rules.

This package is the **Laravel integration** for the framework-agnostic [`cboxdk/dns`](https://github.com/cboxdk/dns) engine. The DNS protocol handling, verification, propagation, SPF/DMARC parsing, and DNSSEC chain validation all live in that core library; this package wires it into the container, config, the console, and the validator so it is one `composer require` away in a Laravel app.

Installation
------------

[](#installation)

```
composer require cboxdk/laravel-dns
```

The service provider is auto-discovered. Publish the config if you want to tune the resolver:

```
php artisan vendor:publish --tag="dns-config"
```

It works with zero configuration out of the box (a raw UDP/TCP socket resolver against `1.1.1.1`).

Configuration
-------------

[](#configuration)

`config/dns.php`:

KeyEnvDefaultPurpose`resolver``DNS_RESOLVER``socket`Transport: `socket` (raw UDP/TCP) or `doh` (DNS-over-HTTPS JSON).`nameserver``DNS_NAMESERVER``1.1.1.1`Recursive resolver for the socket transport.`timeout``DNS_TIMEOUT``3.0`Per-query timeout, seconds.`doh_endpoint``DNS_DOH_ENDPOINT``https://dns.google/resolve`JSON DoH endpoint when `resolver=doh`.`challenge_prefix``DNS_CHALLENGE_PREFIX``_cbox-challenge`Label for ownership-verification TXT records.`allow_non_public_nameservers``DNS_ALLOW_NON_PUBLIC_NAMESERVERS``false`Lifts the SSRF filter on authoritative reads. Local testing only.> The `socket` transport can target a zone's own authoritative nameservers, which domain-ownership verification and propagation checks require. The `doh`transport only queries a provider's recursive resolver, so it cannot answer authoritative or propagation queries.

Facade
------

[](#facade)

```
use Cbox\LaravelDns\Facades\Dns;
use Cbox\Dns\Enums\RecordType;

$response = Dns::lookup('example.com', RecordType::MX);
$response->values();                       // ['mail.example.com']

Dns::verifyDomain('example.com', $token);  // bool — read authoritatively
Dns::challengeHost('example.com');         // '_cbox-challenge.example.com'

$report = Dns::diagnose('example.com');    // Cbox\Dns\Diagnostics\Report
$report->hasErrors();

Dns::dnssec()->validate('example.com');    // Cbox\Dns\Dnssec\ValidationResult
```

You can also inject the core types directly — the container binds both `Cbox\Dns\Dns` and the `Cbox\Dns\Contracts\Resolver` contract:

```
public function __construct(private \Cbox\Dns\Dns $dns) {}
```

Artisan commands
----------------

[](#artisan-commands)

```
php artisan dns:lookup example.com MX          # table of records
php artisan dns:verify example.com      # ownership challenge + result
php artisan dns:diagnose example.com           # grouped findings, non-zero exit on errors
php artisan dns:propagation www.example.com A example.com [--all]
php artisan dns:dnssec example.com             # secure / insecure / bogus + reason
```

Validation rules
----------------

[](#validation-rules)

```
use Cbox\LaravelDns\Rules\DnsRecordExists;
use Cbox\LaravelDns\Rules\DomainVerified;
use Cbox\Dns\Enums\RecordType;

$request->validate([
    'mail_domain' => ['required', new DnsRecordExists(RecordType::MX)],
    'domain'      => ['required', new DomainVerified($team->dns_token)],
]);
```

`DnsRecordExists` fails when the value resolves no record of the given type; `DomainVerified` fails unless the value publishes the challenge token in its authoritative TXT record.

Testing
-------

[](#testing)

Compose `InteractsWithDns` into your host application's `TestCase` to stub records and assert with zero network I/O:

```
use Cbox\LaravelDns\Testing\InteractsWithDns;
use Cbox\Dns\Enums\RecordType;

$this->fakeDns()->stub('example.com', RecordType::MX, ['mail.example.com']);

Dns::lookup('example.com', RecordType::MX)->values(); // ['mail.example.com']
```

`fakeDns()` swaps the container's resolver and `Dns` bindings for an in-memory fake, so the facade, commands, and validation rules all resolve stubbed records.

Requirements
------------

[](#requirements)

- PHP 8.4+
- Laravel 12.x or 13.x

The DNS engine
--------------

[](#the-dns-engine)

All DNS behaviour is provided by [`cboxdk/dns`](https://github.com/cboxdk/dns) — including the spoofing-resistant resolver, the SSRF-guarded authoritative reader, SPF/DMARC/CAA parsing, and DNSSEC chain validation against the IANA root trust anchors. This package claims only the Laravel integration.

Documentation
-------------

[](#documentation)

Full documentation lives in [`docs/`](docs/index.md).

Credits
-------

[](#credits)

- [Sylvester Damgaard](https://github.com/cboxdk)

License
-------

[](#license)

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

###  Health Score

43

—

FairBetter than 89% of packages

Maintenance90

Actively maintained with recent releases

Popularity24

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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

47d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b9761a79e61f2d5b9d650510dfb3555da18daf38f027aa84012c937e397e39a7?d=identicon)[cboxdk](/maintainers/cboxdk)

---

Top Contributors

[![sylvesterdamgaard](https://avatars.githubusercontent.com/u/2431914?v=4)](https://github.com/sylvesterdamgaard "sylvesterdamgaard (1 commits)")

---

Tags

dmarcdnsdns-diagnosticsdnssecdomain-verificationlaravelpropagationspfvalidation-rulelaraveldnsDNSSECspfdmarcvalidation rulepropagationdomain-verificationdns-diagnostics

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/cboxdk-laravel-dns/health.svg)

```
[![Health](https://phpackages.com/badges/cboxdk-laravel-dns/health.svg)](https://phpackages.com/packages/cboxdk-laravel-dns)
```

###  Alternatives

[laravel/ai

The official AI SDK for Laravel.

1.1k6.4M360](/packages/laravel-ai)[laravel/sail

Docker files for running a basic Laravel application.

1.9k220.0M1.5k](/packages/laravel-sail)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

80732.6M270](/packages/laravel-mcp)[propaganistas/laravel-disposable-email

Disposable email validator

6093.4M9](/packages/propaganistas-laravel-disposable-email)[laravel/boost

Laravel Boost accelerates AI-assisted development by providing the essential context and structure that AI needs to generate high-quality, Laravel-specific code.

3.6k31.1M880](/packages/laravel-boost)[spatie/laravel-health

Monitor the health of a Laravel application

89313.5M195](/packages/spatie-laravel-health)

PHPackages © 2026

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