Aerys\Host classHost






__construct —public function__construct()
No documentation.
__clone —public function__clone()
No documentation.
expose —public functionexpose(string$address,int$port):self

Assign the IP and port on which to listen

The address may be any valid IPv4 or IPv6 address. The "" indicates "all IPv4 interfaces" and is appropriate for most users. Use "::" to indicate "all IPv6 interfaces". To indicate "all IPv4 and IPv6 interfaces", use a "*" wildcard character.

Note that "::" may also listen on some systems on IPv4 interfaces. PHP currently does not expose the IPV6_V6ONLY constant.

Any valid port number [1-65535] may be used. Port numbers lower than 256 are reserved for well-known services (like HTTP on port 80) and port numbers less than 1024 require root access on UNIX-like systems. The default port for encrypted sockets (https) is 443. If you plan to use encryption with this host you'll generally want to use port 443.

Type Parameter Description Default Value
string $address The IPv4 or IPv6 interface to listen to none
int $port The port number on which to listen none
name —public functionname(string$name):self

Assign a domain name (e.g. localhost or or

A host name is only required if a server exposes more than one host. If a name is not defined the server will default to "localhost"

Type Parameter Description Default Value
string $name No documentation. none
use —public functionuse(callable|Aerys\Middleware|Aerys\Bootable|Aerys\Monitor$action):self

Use a callable request action or Middleware

Host actions are invoked to service requests in the order in which they are added.

Type Parameter Description Default Value
callable|Aerys\Middleware|Aerys\Bootable|Aerys\Monitor $action No documentation. none
encrypt —public functionencrypt(string$certificate,string|null$key =null,array$options =[]):self

Define TLS encryption settings for this host

Type Parameter Description Default Value
string $certificate A string path pointing to your SSL/TLS certificate none
string|null $key A string path pointing to your SSL/TLS key file (null if the certificate file is containing the key already) null
array $options An optional array mapping additional SSL/TLS settings []
redirect —public functionredirect(string$absoluteUri,int$redirectCode =307):self

Redirect all requests that aren't serviced by an action callable

NOTE: the redirect URI must match the format "scheme://hostname.tld" (with optional port and path).

The following example redirects all unencrypted requests to the equivalent encrypted resource:

 // Redirect to
 $host = new Aerys\Host;
Type Parameter Description Default Value
string $absoluteUri The location to which we wish to redirect none
int $redirectCode The HTTP redirect status code (300-399) 307
separateIPv4Binding —public functionseparateIPv4Binding():bool
No documentation.
export —public functionexport():array

Retrieve an associative array summarizing the host definition

getDefinitions —public functiongetDefinitions():array

Used by the server bootstrapper to access host configs created by the application