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.
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!
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.
Check out uptimeproject.io