1
0
mirror of https://github.com/danog/dns.git synced 2024-11-30 04:29:06 +01:00
Go to file
2022-07-04 15:37:54 -05:00
.github/workflows Drop support for PHP 8.0 2022-02-23 00:21:48 +01:00
docs Update docs 2021-12-15 23:43:20 +01:00
examples Rename Config to DnsConfig 2022-07-04 15:24:42 -05:00
src Add readonly where applicable 2022-07-04 15:37:54 -05:00
test Rename Config to DnsConfig 2022-07-04 15:24:42 -05:00
.editorconfig Switch to a new API to enable getting not only the first entry and not only A/AAAA records 2015-09-08 17:27:33 +02:00
.gitattributes Ignore docs/asset on export 2018-05-16 22:23:07 +02:00
.gitignore Update revolt and php-cs-fixer 2022-02-03 22:06:03 +01:00
.gitmodules Update to new shared docs repo 2017-09-27 14:49:02 +02:00
.php-cs-fixer.dist.php Update revolt and php-cs-fixer 2022-02-03 22:06:03 +01:00
composer-require-check.json Add composer-require-checker and improve CI 2021-12-14 21:03:21 +01:00
composer.json Drop support for PHP 8.0 2022-02-23 00:21:48 +01:00
CONTRIBUTING.md Massive refactor using amp/1.0.0 2015-08-01 22:38:25 -04:00
LICENSE Update revolt and php-cs-fixer 2022-02-03 22:06:03 +01:00
phpunit.xml.dist Move lib → src 2021-12-15 23:55:47 +01:00
psalm.xml Drop support for PHP 8.0 2022-02-23 00:21:48 +01:00
README.md Fix usage of deprecated APIs 2022-02-03 23:41:14 +01:00

dns

Build Status License

amphp/dns provides asynchronous DNS resolution for PHP based on Amp.

Installation

composer require amphp/dns

Example

<?php

require __DIR__ . '/examples/_bootstrap.php';

$githubIpv4 = Amp\Dns\resolve("github.com", Dns\Record::A);
pretty_print_records("github.com", $githubIpv4);

$firstGoogleResult = Amp\Future\awaitFirst([
  Amp\async(fn() => Amp\Dns\resolve("google.com", Dns\Record::A)),
  Amp\async(fn() => Amp\Dns\resolve("google.com", Dns\Record::AAAA)),
]);

pretty_print_records("google.com", $firstGoogleResult);

$combinedGoogleResult = Amp\Dns\resolve("google.com");
pretty_print_records("google.com", $combinedGoogleResult);

$googleMx = Amp\Dns\query("google.com", Amp\Dns\Record::MX);
pretty_print_records("google.com", $googleMx);