This package is abandoned and no longer maintained. No replacement package was suggested.

DNS Resolving in PHP

1.3.0 2021-04-07 14:54 UTC

This package is auto-updated.

Last update: 2022-10-04 15:54:26 UTC


README

68747470733a2f2f757074696d6570726f6a6563742e696f2f696d672f6c6f676f2e706e67

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