1
0
mirror of https://github.com/danog/dns.git synced 2024-11-30 04:29:06 +01:00
Go to file
2017-06-23 15:34:12 +02:00
lib Purge requests if they're still in the map after 65k requests in between 2017-06-23 15:34:12 +02:00
test Add test domain that has a CNAME 2017-06-23 13:18:12 +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 Massive refactor using amp/1.0.0 2015-08-01 22:38:25 -04:00
.gitignore Add config test 2017-06-22 23:39:13 +02:00
.php_cs.dist Update to PHPUnit 6, update code style 2017-06-17 10:49:54 +02:00
.travis.yml Update to PHPUnit 6, update code style 2017-06-17 10:49:54 +02:00
appveyor.yml Don't use shallow_clone, as the exported project doesn't include tests 2017-06-23 15:09:24 +02:00
composer.json WIP 2017-06-23 00:34:11 -05:00
CONTRIBUTING.md Massive refactor using amp/1.0.0 2015-08-01 22:38:25 -04:00
LICENSE Massive refactor using amp/1.0.0 2015-08-01 22:38:25 -04: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 Remove TYPE_ prefix for record constants 2017-06-22 20:08:27 +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\Loop;

Loop::run(function () {
    $githubIpv4 = (yield Amp\Dns\resolve("github.com", $options = ["types" => Amp\Dns\Record::A]));
    var_dump($githubIpv4);

    $googleIpv4 = Amp\Dns\resolve("google.com", $options = ["types" => Amp\Dns\Record::A]);
    $googleIpv6 = Amp\Dns\resolve("google.com", $options = ["types" => Amp\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);
});