1
0
mirror of https://github.com/danog/dns.git synced 2024-11-26 20:14:51 +01:00
Go to file
2018-12-24 16:23:04 +01:00
docs Update shared documentation files 2018-05-16 16:15:37 +02:00
examples Improve example formatting and add PTR example 2017-09-12 17:05:40 +02:00
lib Move localhost fallback generation to Config, use cloudflare DNS as DNS fallback 2018-12-24 16:23:04 +01:00
test Accept different exception message for dead sockets 2018-05-01 20:08:54 +02: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 Add config test 2017-06-22 23:39:13 +02:00
.gitmodules Update to new shared docs repo 2017-09-27 14:49:02 +02:00
.php_cs.dist Update to PHPUnit 6, update code style 2017-06-17 10:49:54 +02:00
.travis.yml Disable phpdbg, because it causes segfaults 2017-12-15 17:03:56 +01:00
appveyor.yml Fix PATH on AppVeyor 2017-12-15 17:14:52 +01:00
composer.json Use ext-filter instead of inet_pton to avoid error suppression (#73) 2018-03-31 17:56:32 +02:00
CONTRIBUTING.md Massive refactor using amp/1.0.0 2015-08-01 22:38:25 -04:00
LICENSE Update LICENSE date 2017-06-24 08:14:50 +02:00
Makefile Update to PHPUnit 6, update code style 2017-06-17 10:49:54 +02:00
phpunit.xml.dist Update to PHPUnit 6, update code style 2017-06-17 10:49:54 +02:00
README.md Add documentation and update README 2017-07-06 21:22:39 +02:00

dns

Build Status CoverageStatus License

amphp/dns provides asynchronous DNS name resolution for Amp.

Installation

composer require amphp/dns

Example

<?php

require __DIR__ . '/vendor/autoload.php';

use Amp\Dns;
use Amp\Loop;

Loop::run(function () {
    $githubIpv4 = yield Dns\resolve("github.com", Dns\Record::A);
    var_dump($githubIpv4);

    $googleIpv4 = Amp\Dns\resolve("google.com", Dns\Record::A);
    $googleIpv6 = Amp\Dns\resolve("google.com", Dns\Record::AAAA);

    $firstGoogleResult = yield Amp\Promise\first([$googleIpv4, $googleIpv6]);
    var_dump($firstGoogleResult);
    
    $combinedGoogleResult = yield Amp\Dns\resolve("google.com");
    var_dump($combinedGoogleResult);
    
    $googleMx = yield Amp\Dns\query("google.com", Amp\Dns\Record::MX);
    var_dump($googleMx);
});