UserIpReader
in package
Service to retrieve user IP address.
Tags
Table of Contents
- $allowForwardedIps : string|bool
- Configuration specifying allowed HTTP headers containing IPs (false for none).
- $ipFilter : array<string|int, mixed>
- IP addresses to exclude from consideration
- $server : Parameters
- Server parameters
- __construct() : mixed
- Constructor
- getUserIp() : string
- Get the active user's IP address. Returns null if no address can be found.
Properties
$allowForwardedIps
Configuration specifying allowed HTTP headers containing IPs (false for none).
protected
string|bool
$allowForwardedIps
See [Proxy] allow_forwarded_ips setting in config.ini for more details.
$ipFilter
IP addresses to exclude from consideration
protected
array<string|int, mixed>
$ipFilter
$server
Server parameters
protected
Parameters
$server
Methods
__construct()
Constructor
public
__construct(Parameters $server[, string|bool $allowForwardedIps = false ][, array<string|int, mixed> $ipFilter = [] ]) : mixed
Parameters
- $server : Parameters
-
Server parameters
- $allowForwardedIps : string|bool = false
-
Forwarded header configuration string (false to disable checking IP-related X- headers)
- $ipFilter : array<string|int, mixed> = []
-
IP addresses to exclude from consideration
Return values
mixed —getUserIp()
Get the active user's IP address. Returns null if no address can be found.
public
getUserIp() : string