This package is abandoned and no longer maintained. No replacement package was suggested.

Phergie plugin for Looking up IP's by hostnames

4.0.0 2015-12-28 23:49 UTC

This package is auto-updated.

Last update: 2020-03-15 03:38:58 UTC


Phergie plugin for Looking up IP's by hostnames.

Build Status


To install via Composer, use the command below, it will automatically detect the latest version and bind it with ~.

composer require phergie/phergie-irc-plugin-dns 

See Phergie documentation for more information on installing and enabling plugins.


new \Phergie\Plugin\Dns\Plugin([

    // All configuration is optional

    'dnsServer' => '', // IP address of a DNS server, defaults to Google's

    // or

    'command' => 'customDns', // command name, defaults to dns

    // or

    'resolver' => new React\Dns\Resolver\Resolver(), // provide your own Resolver instance
                                                     // defaults to null and is set at first use
                                                     // (don't use this unless you know what you are doing!)

    // or

    'enableCommand' => false,  // enable use access to the dns command


This plugin listens on a few events providing the resolver to other plugins that wish to make use of it.


The dns.resolve event accepts a callback that will be called with a Promise that will resolve once the given hostname has been resolved. (If promises are new to you, be sure to read this.)

$this->emitter->emit('dns.resolve', [function($promise) use ($callback, $that) {
    $promise->then(function($ip) {
        echo 'IP for ' . $ip . PHP_EOL;


The dns.resolver event accepts a callback that will be called once a Resolver instance has been created.

$this->emitter->emit('dns.resolver', [function($resolver) use ($callback, $that) {
    $resolver->resolve('')->then(function($ip) {
        echo 'IP for ' . $ip . PHP_EOL;


To run the unit test suite:

curl -s | php
php composer.phar install
cd tests


Released under the MIT License. See LICENSE.