1
0
mirror of https://github.com/danog/dns.git synced 2025-01-22 13:31:12 +01:00
2019-05-14 19:14:27 +02:00
2019-03-13 17:43:10 +01:00
2018-05-16 22:23:07 +02:00
2017-06-22 23:39:13 +02:00
2017-09-27 14:49:02 +02:00
2019-01-24 19:27:47 -06:00
2019-01-24 22:12:31 -06:00
2019-03-12 20:42:11 +01:00
2019-03-03 09:05:43 -06:00
2017-06-24 08:14:50 +02:00
2019-03-13 17:34:18 +01:00

dns

Build Status CoverageStatus License

amphp/dns provides asynchronous DNS name resolution for Amp.

Installation

composer require amphp/dns

Example

<?php

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

use Amp\Dns;
use Amp\Loop;

Loop::run(function () {
    $githubIpv4 = yield Dns\resolve("github.com", Dns\Record::A);
    pretty_print_records("github.com", $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]);
    pretty_print_records("google.com", $firstGoogleResult);

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

    $googleMx = yield Amp\Dns\query("google.com", Amp\Dns\Record::MX);
    pretty_print_records("google.com", $googleMx);
});
Description
No description provided
Readme MIT 676 KiB
Languages
PHP 98.6%
Makefile 1.4%