Skip to content

Resolve DNS records from a specified nameserver.

License

Notifications You must be signed in to change notification settings

uptimeproject/dns

Repository files navigation

Codecov GitHub Workflow Status Packagist PHP Version Support Packagist PHP Version Support Packagist Downloads

This tool is meant as a replacement for dns_get_record with some extra functionality.

Mainly, it adds the ability to specify a custom nameserver through which to resolve records.

How to use

composer require uptimeproject/dns
$resolver = new \UptimeProject\Dns\DnsResolver;

$records = $resolver->resolve('example.com', 'A', 'ns.example.com');

foreach ($records as $record) {
    echo "The {$record->getType()} record for {$record->getName()} resolves\n";
    echo "to {$record->getContent()} with a TTL of {$record->getTTL()} seconds.\n";
}

Specifying the nameserver is optional.

As it is built on top of spatie/dns this tool is inherently built on dig. Make sure you have dig installed, otherwise you cannot use this package!

How to contribute

Feel free to create a PR if you have any ideas for improvements. Or create an issue.

  • When adding code, make sure to add tests for it (phpunit).
  • Make sure the code adheres to our coding standards (use php-cs-fixer to check/fix).
  • Also make sure PHPStan does not find any bugs.
vendor/bin/php-cs-fixer fix

vendor/bin/phpstan analyze

vendor/bin/phpunit --coverage-text

phpdbg -qrr vendor/bin/infection

These tools will also run in GitHub actions on PR's and pushes on main.

UptimeProject.io

Check out uptimeproject.io

About

Resolve DNS records from a specified nameserver.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages