RequestInterface
in
Expected behavior of an HTTP request
Tags
Table of Contents
- getIPAddress() : string
- Gets the user's IP address.
- getMethod() : string
- Get the request method.
- getServer() : mixed
- Fetch an item from the $_SERVER array.
- isValidIP() : bool
- Validate an IP address
Methods
getIPAddress()
Gets the user's IP address.
public
getIPAddress() : string
Supplied by RequestTrait.
Return values
string —IP address
getMethod()
Get the request method.
public
getMethod([bool $upper = false ]) : string
An extension of PSR-7's getMethod to allow casing.
Parameters
- $upper : bool = false
-
Whether to return in upper or lower case.
Tags
Return values
string —getServer()
Fetch an item from the $_SERVER array.
public
getServer([string $index = null ][, null $filter = null ]) : mixed
Supplied by RequestTrait.
Parameters
- $index : string = null
-
Index for item to be fetched from $_SERVER
- $filter : null = null
-
A filter name to be applied
Return values
mixed —isValidIP()
Validate an IP address
public
isValidIP(string $ip[, string $which = null ]) : bool
Parameters
- $ip : string
-
IP Address
- $which : string = null
-
IP protocol: 'ipv4' or 'ipv6'