Documentation

Factory
in package

FinalYes

Table of Contents

Methods

create()  : ResolverInterface
Creates a DNS resolver instance for the given DNS config
createCached()  : ResolverInterface
Creates a cached DNS resolver instance for the given DNS config and cache
createExecutor()  : CoopExecutor
createSingleExecutor()  : ExecutorInterface
createTcpExecutor()  : TimeoutExecutor
createUdpExecutor()  : TimeoutExecutor
decorateHostsFileExecutor()  : ExecutorInterface
Tries to load the hosts file and decorates the given executor on success

Methods

create()

Creates a DNS resolver instance for the given DNS config

public create(Config|string $config[, LoopInterface|null $loop = null ]) : ResolverInterface

As of v1.7.0 it's recommended to pass a Config object instead of a single nameserver address. If the given config contains more than one DNS nameserver, all DNS nameservers will be used in order. The primary DNS server will always be used first before falling back to the secondary or tertiary DNS server.

Parameters
$config : Config|string

DNS Config object (recommended) or single nameserver address

$loop : LoopInterface|null = null
Tags
throws
InvalidArgumentException

for invalid DNS server address

throws
UnderflowException

when given DNS Config object has an empty list of nameservers

Return values
ResolverInterface

createCached()

Creates a cached DNS resolver instance for the given DNS config and cache

public createCached(Config|string $config[, LoopInterface|null $loop = null ][, CacheInterface|null $cache = null ]) : ResolverInterface

As of v1.7.0 it's recommended to pass a Config object instead of a single nameserver address. If the given config contains more than one DNS nameserver, all DNS nameservers will be used in order. The primary DNS server will always be used first before falling back to the secondary or tertiary DNS server.

Parameters
$config : Config|string

DNS Config object (recommended) or single nameserver address

$loop : LoopInterface|null = null
$cache : CacheInterface|null = null
Tags
throws
InvalidArgumentException

for invalid DNS server address

throws
UnderflowException

when given DNS Config object has an empty list of nameservers

Return values
ResolverInterface

createExecutor()

private createExecutor(Config|string $nameserver, LoopInterface $loop) : CoopExecutor
Parameters
$nameserver : Config|string
$loop : LoopInterface
Tags
throws
InvalidArgumentException

for invalid DNS server address

throws
UnderflowException

when given DNS Config object has an empty list of nameservers

Return values
CoopExecutor

        
On this page

Search results