PHP Class Aerys\Host

Afficher le fichier Open project: amphp/aerys Class Usage Examples

Méthodes publiques

Méthode Description
__clone ( )
__construct ( )
encrypt ( string $certificate, string $key = null, array $options = [] ) : Host Define TLS encryption settings for this host
export ( ) : array Retrieve an associative array summarizing the host definition
expose ( string $address, integer $port ) : Host Assign the IP and port on which to listen
getDefinitions ( ) : array Used by the server bootstrapper to access host configs created by the application
name ( string $name ) : Host Assign a domain name (e.g. localhost or mysite.com or subdomain.mysite.com)
redirect ( string $absoluteUri, integer $redirectCode = 307 ) : Host Redirect all requests that aren't serviced by an action callable
separateIPv4Binding ( ) : boolean
use ( callable | aerys\Middleware | aerys\Bootable | aerys\Monitor $action ) : Host Use a callable request action or Middleware

Method Details

__clone() public méthode

public __clone ( )

__construct() public méthode

public __construct ( )

encrypt() public méthode

Define TLS encryption settings for this host
public encrypt ( string $certificate, string $key = null, array $options = [] ) : Host
$certificate string A string path pointing to your SSL/TLS certificate
$key string A string path pointing to your SSL/TLS key file (null if the certificate file is containing the key already)
$options array An optional array mapping additional SSL/TLS settings
Résultat Host

export() public méthode

Retrieve an associative array summarizing the host definition
public export ( ) : array
Résultat array

expose() public méthode

The address may be any valid IPv4 or IPv6 address. The "0.0.0.0" 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.
public expose ( string $address, integer $port ) : Host
$address string The IPv4 or IPv6 interface to listen to
$port integer The port number on which to listen
Résultat Host

getDefinitions() public static méthode

Used by the server bootstrapper to access host configs created by the application
public static getDefinitions ( ) : array
Résultat array

name() public méthode

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"
public name ( string $name ) : Host
$name string
Résultat Host

redirect() public méthode

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: setName("mysite.com"); $host->redirect("https://mysite.com");
public redirect ( string $absoluteUri, integer $redirectCode = 307 ) : Host
$absoluteUri string The location to which we wish to redirect
$redirectCode integer The HTTP redirect status code (300-399)
Résultat Host

separateIPv4Binding() public static méthode

public static separateIPv4Binding ( ) : boolean
Résultat boolean

use() public méthode

Host actions are invoked to service requests in the order in which they are added.
public use ( callable | aerys\Middleware | aerys\Bootable | aerys\Monitor $action ) : Host
$action callable | aerys\Middleware | aerys\Bootable | aerys\Monitor
Résultat Host