Skip to content
PHP Ecosystem
Explore

IpAllowlist

API reference › Debug › IpAllowlist

final readonly classyii\debug\IpAllowlist
Sourcesrc/IpAllowlist.php

Matches a requesting IP against the debugger’s allowed IP filters and host allowlist.

MethodDescriptionDefined by
__construct()Retains the IP filters and hostnames used when checking access.IpAllowlist
matches()Returns whether the IP matches any allowed IP filter or resolves from any allowed host.IpAllowlist
public function __construct(list<string> $allowedIPs, list<string> $allowedHosts)

Retains the IP filters and hostnames used when checking access.

Parameters

ParameterTypeDescription
$allowedIPslist<string>Exact, wildcard, or CIDR IP filters.
$allowedHostslist<string>Hostnames resolved to IPs at check time.
public function matches(string $ip): bool

Returns whether the IP matches any allowed IP filter or resolves from any allowed host.

Parameters

ParameterTypeDescription
$ipstringRequesting IP address.

Returns

bool: true when the IP is allowed.