class IpUtils
Http utility functions.
static bool | checkIp(string $requestIp, string|array $ips) Checks if an IPv4 or IPv6 address is contained in the list of given IPs or subnets. | |
static bool | checkIp4(string $requestIp, string $ip) Compares two IPv4 addresses. | |
static bool | checkIp6(string $requestIp, string $ip) Compares two IPv6 addresses. |
Checks if an IPv4 or IPv6 address is contained in the list of given IPs or subnets.
string | $requestIp | IP to check |
string|array | $ips | List of IPs or subnets (can be a string if only a single one) |
bool | Whether the IP is valid |
Compares two IPv4 addresses.
In case a subnet is given, it checks if it contains the request IP.
string | $requestIp | IPv4 address to check |
string | $ip | IPv4 address or subnet in CIDR notation |
bool | Whether the request IP matches the IP, or whether the request IP is within the CIDR subnet |
Compares two IPv6 addresses.
In case a subnet is given, it checks if it contains the request IP.
string | $requestIp | IPv6 address to check |
string | $ip | IPv6 address or subnet in CIDR notation |
bool | Whether the IP is valid |
RuntimeException | When IPV6 support is not enabled |
https://github.com/dsp/v6tools |
© 2004–2017 Fabien Potencier
Licensed under the MIT License.
https://api.symfony.com/4.1/Symfony/Component/HttpFoundation/IpUtils.html