Simple, async multicast DNS (mDNS) resolver library, built on top of React PHP.
Multicast DNS name resolution is commonly used as part of zeroconf networking ala Bonjour/Avahi. It is defined in RFC 6762, in particular this specification also highlights the differences to normal DNS operation.
The mDNS protocol is related to, but independent of, DNS-Based Service Discovery (DNS-SD) as defined in RFC 6763.
Note: This project is in early alpha stage! Feel free to report any issues you encounter.
Once installed, you can use the following code to look up the address of a local domain name:
$loop = React\EventLoop\Factory::create();
$factory = new Factory($loop);
$resolver = $factory->createResolver();
$resolver->lookup('hostname.local')->then(function ($ip) {
echo 'Found: ' . $ip . PHP_EOL;
});
$loop->run();
See also the examples.
The recommended way to install this library is through composer. New to composer?
{
"require": {
"clue/mdns-react": "dev-master"
}
}
MIT