Download the PHP package jinomial/laravel-dns without Composer
On this page you can find all versions of the php package jinomial/laravel-dns. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jinomial/laravel-dns
More information about jinomial/laravel-dns
Files in jinomial/laravel-dns
Package laravel-dns
Short Description A DNS service for Laravel
License MIT
Homepage https://github.com/jinomial/laravel-dns
Informations about the package laravel-dns
Laravel DNS
A powerful DNS service and facade for Laravel. V4 brings a robust model-based architecture, semantic query methods, and built-in caching.
| Driver | Description |
|---|---|
| doh | DNS over HTTPS (DoH) |
| system | PHP's dns_get_record() |
| Specialized Google DNS (DoH) | |
| cloudflare | Specialized Cloudflare (DoH) |
| dig | System dig command wrapper |
| array | Mock/Static records driver |
| udp | Custom UDP DNS (RFC 1035) |
Installation
Install the package via composer:
Publish the config file:
The default configuration uses Cloudflare DoH:
Usage
V4 returns DnsRecordCollection containing DnsRecord objects, providing a consistent API across drivers.
Basic Query
Semantic Methods
V4 includes convenient semantic methods for common record types:
Caching
Easily cache DNS results using the remember method:
Use a Specific Driver
Batch Queries
Multiple lookups can be performed at once. In DoH, these can be performed asynchronously.
Asynchronous Queries (DoH only)
DnsRecord Model
The DnsRecord model standardizes DNS data across all drivers:
The DnsRecordCollection extends Illuminate\Support\Collection, giving you access to all Laravel collection methods like filter, map, and pluck.
Migration from V3 to V4
V4 is a major refactor focused on type safety and developer experience.
Return Type Changes
- V3:
query()returned raw arrays specific to each driver. - V4:
query()returns aJinomial\LaravelDns\DnsRecordCollection.
Update Needed: If you were accessing array keys directly, update to object properties or use toArray().
Driver Interface
If you implemented custom drivers, you must update your query() method signature to return DnsRecordCollection.
Manager Changes
DnsManager now extends Illuminate\Support\Manager. forgetDrivers() is still supported but forgetSockets() is preferred for semantic consistency.
Custom Drivers
Create a class that implements Jinomial\LaravelDns\Contracts\Dns\Socket.
Register your driver in a Service Provider:
Testing
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-dns with dependencies
guzzlehttp/guzzle Version ^7.10
illuminate/contracts Version ^11.47 || ^12.51