CascadiaPHP 2024

The EventDnsBase class

(PECL event >= 1.2.6-beta)


Represents Libevent's DNS base structure. Used to resolve DNS asyncronously, parse configuration files like resolv.conf etc.

Class synopsis

final class EventDnsBase {
/* Constants */
const int OPTION_SEARCH = 1;
const int OPTION_MISC = 4;
const int OPTIONS_ALL = 15;
const int DISABLE_WHEN_INACTIVE = 32768;
/* Methods */
public __construct( EventBase $base , int|bool $initialize )
public addNameserverIp( string $ip ): bool
public addSearch( string $domain ): void
public clearSearch(): void
public loadHosts( string $hosts ): bool
public parseResolvConf( int $flags , string $filename ): bool
public setOption( string $option , string $value ): bool
public setSearchNdots( int $ndots ): bool

Predefined Constants

Tells to read the domain and search fields from the resolv.conf file and the ndots option, and use them to decide which domains(if any) to search for hostnames that aren’t fully-qualified.


Tells to learn the nameservers from the resolv.conf file.



Tells to read a list of hosts from /etc/hosts as part of loading the resolv.conf file.


Tells to learn as much as it can from the resolv.conf file.


Do not prevent the libevent event loop from exiting when we have no active DNS requests.


Process the resolv.conf.


Do not add default nameserver if there are no nameservers in the resolv.conf.

Table of Contents

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top