dns [![Build Status](https://travis-ci.org/amphp/dns.svg?branch=master)](https://travis-ci.org/amphp/dns) ============ Asynchronous DNS resolution built on the [Amp](https://github.com/amphp/amp) concurrency framework ## Examples **Synchronous Resolution Via `Amp\wait()`** ```php resolve($name)); printf("%s resolved to %s\n", $name, $address); ``` **Concurrent Synchronous Resolution Via `wait()`** ```php resolve($name); } $comboPromise = Amp\all($promises); $results = Amp\wait($comboPromise); foreach ($results as $name => $resultArray) { list($addr, $type) = $resultArray; printf("%s => %s\n", $name, $addr); } ``` **Event Loop Async** ```php resolve($name); $promises[$name] = $promise; } // Yield control until the combo promise resolves list($errors, $successes) = (yield 'some' => $promises); foreach ($names as $name) { echo isset($errors[$name]) ? "FAILED: {$name}\n" : "{$name} => {$successes[$name][0]}\n"; } // Stop the event loop so we don't sit around forever Amp\stop(); }); ``` ## Tests [![Build Status](https://travis-ci.org/amphp/dns.svg?branch=master)](https://travis-ci.org/amphp/dns) Tests can be run from the command line using: `php vendor/bin/phpunit -c phpunit.xml` or to exclude tests that require a working internet connection: `php vendor/bin/phpunit -c phpunit.xml --exclude-group internet`