function IpUtils::checkIp
Checks if an IPv4 or IPv6 address is contained in the list of given IPs or subnets.
Parameters
string|array $ips List of IPs or subnets (can be a string if only a single one):
5 calls to IpUtils::checkIp()
- IpsRequestMatcher::matches in vendor/
symfony/ http-foundation/ RequestMatcher/ IpsRequestMatcher.php - Decides whether the rule(s) implemented by the strategy matches the supplied request.
- IpUtils::isPrivateIp in vendor/
symfony/ http-foundation/ IpUtils.php - Checks if an IPv4 or IPv6 address is contained in the list of private IP subnets.
- Request::isFromTrustedProxy in vendor/
symfony/ http-foundation/ Request.php - Indicates whether this request originated from a trusted proxy.
- Request::normalizeAndFilterClientIps in vendor/
symfony/ http-foundation/ Request.php - SubRequestHandler::handle in vendor/
symfony/ http-kernel/ HttpCache/ SubRequestHandler.php
File
-
vendor/
symfony/ http-foundation/ IpUtils.php, line 50
Class
- IpUtils
- Http utility functions.
Namespace
Symfony\Component\HttpFoundationCode
public static function checkIp(string $requestIp, string|array $ips) : bool {
if (!\is_array($ips)) {
$ips = [
$ips,
];
}
$method = substr_count($requestIp, ':') > 1 ? 'checkIp6' : 'checkIp4';
foreach ($ips as $ip) {
if (self::$method($requestIp, $ip)) {
return true;
}
}
return false;
}