gemz / dns
Get simply DNS records
Fund package maintenance!
Patreon
Installs: 13 117
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 1
Open Issues: 0
Requires
- php: ^7.1.3
- react/dns: ^1.2
- react/event-loop: ^1.1.1
Requires (Dev)
- mockery/mockery: ^1.0
- phpstan/phpstan: ^0.12.8
- phpunit/phpunit: ^8.2
- symfony/var-dumper: ^4.3|^5.0
This package is auto-updated.
Last update: 2025-02-19 07:41:31 UTC
README
Retrieve DNS records for a given domain. Under the hood the package uses https://github.com/reactphp/reactphp for concurrent dns queries.
Installation
You can install the package via composer:
composer require gemz/dns
Usage
use Gemz\Dns\Dns; // initialization $dns = new Dns('gemz.io'); $dns = Dns::for('gemz.io'); // supported record types // returns ["A", "CAA", "CNAME", "SOA", "TXT", "MX", "AAAA", "SRV", "NS", "PTR", "SSHFP"] $dns = Dns::for('gemz.io')->allowedRecordTypes(); // get results for all record types $dns = Dns::for('gemz.io')->records(); // get result for specific record(s) $dns = Dns::for('gemz.io')->records(['A', 'CNAME']); $dns = Dns::for('gemz.io')->records('A', 'MX', 'TXT'); // using a nameserver $dns = Dns::for('gemz.io')->useNameServer('example.gemz.io')->records(); // sanitizing domain $domain = Dns::for('https://gemz.io')->getDomain(); // gemz.io // record type results $dns = Dns::for('gemz.io')->records('A', 'NS'); // depending on the record type "data" will be a string or an array with different keys // result is an array in form of: [ "A" => [ ["ttl" => 21599, "data" => "<ip>"] ], "NS" => [ ["ttl" => 21599, "data" => "<nameserver1>"], ["ttl" => 21599, "data" => "<nameserver2>"], ], "MX" => [ ["ttl" => 21599, "data" => ["priority" => 10, "target" => "<mx1>"]], ["ttl" => 21599, "data" => ["priority" => 20, "target" => "<mx2>"]], ] ];
Testing
composer test
composer test-coverage
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email stefan@sriehl.com instead of using the issue tracker.
Credits
Support us
Gemz.io is maintained by Stefan Riehl. You'll find all open source projects on Gemz.io github.
License
The MIT License (MIT). Please see License File for more information.