PHP Class Longman\IPTools\Ip

Afficher le fichier Open project: akalongman/php-ip-tools Class Usage Examples

Protected Properties

Свойство Type Description
$ip
$isv6

Méthodes publiques

Méthode Description
compare ( string $ip, string $range ) : boolean Checks if an IP is part of an IP range.
ip2long ( string $ip ) : long Gets IP long representation
isLocal ( string $ip ) : boolean Checks if an IP is local
isRemote ( string $ip ) : boolean Checks if an IP is remot
isValid ( string $ip ) : boolean Checks if an IP is valid.
isValidv4 ( string $ip ) : boolean Checks if an IP is valid IPv4 format.
isValidv6 ( string $ip ) : boolean Checks if an IP is valid IPv6 format.
long2ip ( long $dec, $ipv6 = false ) : string Gets IP string representation from IP long
match ( string $ip, $ranges ) : boolean Checks if an IP is part of an IP range.
matchRange ( $ip, $range )

Méthodes protégées

Méthode Description
processWithAsterisk ( string $range ) : boolean Checks if an IP is part of an IP range.
processWithMinus ( string $range ) : boolean Checks if an IP is part of an IP range.
processWithSlash ( string $range ) : boolean Checks if an IP is part of an IP range.

Method Details

compare() public static méthode

Checks if an IP is part of an IP range.
public static compare ( string $ip, string $range ) : boolean
$ip string IPv4/IPv6
$range string IP range specified in one of the following formats: Wildcard format: 1.2.3.* OR 2001:cdba:0000:0000:0000:0000:3257:* CIDR format: 1.2.3/24 OR 1.2.3.4/255.255.255.0 Start-End IP format: 1.2.3.0-1.2.3.255 OR 2001:cdba:0000:0000:0000:0000:3257:0001-2001:cdba:0000:0000:0000:0000:3257:1000
Résultat boolean true if IP is part of range, otherwise false.

ip2long() public static méthode

Gets IP long representation
public static ip2long ( string $ip ) : long
$ip string IPv4 or IPv6
Résultat long If IP is valid returns IP long representation, otherwise -1.

isLocal() public static méthode

Checks if an IP is local
public static isLocal ( string $ip ) : boolean
$ip string IP
Résultat boolean true if the IP is local, otherwise false

isRemote() public static méthode

Checks if an IP is remot
public static isRemote ( string $ip ) : boolean
$ip string IP
Résultat boolean true if the IP is remote, otherwise false

isValid() public static méthode

Checks if an IP is valid.
public static isValid ( string $ip ) : boolean
$ip string IP
Résultat boolean true if IP is valid, otherwise false.

isValidv4() public static méthode

Checks if an IP is valid IPv4 format.
public static isValidv4 ( string $ip ) : boolean
$ip string IP
Résultat boolean true if IP is valid IPv4, otherwise false.

isValidv6() public static méthode

Checks if an IP is valid IPv6 format.
public static isValidv6 ( string $ip ) : boolean
$ip string IP
Résultat boolean true if IP is valid IPv6, otherwise false.

long2ip() public static méthode

Gets IP string representation from IP long
public static long2ip ( long $dec, $ipv6 = false ) : string
$dec long IPv4 or IPv6 long
Résultat string If IP is valid returns IP string representation, otherwise ''.

match() public static méthode

Checks if an IP is part of an IP range.
public static match ( string $ip, $ranges ) : boolean
$ip string IPv4/IPv6
Résultat boolean true if IP is part of range, otherwise false.

matchRange() public static méthode

public static matchRange ( $ip, $range )

processWithAsterisk() protected static méthode

Checks if an IP is part of an IP range.
protected static processWithAsterisk ( string $range ) : boolean
$range string IP range specified in one of the following formats: Wildcard format: 1.2.3.* OR 2001:cdba:0000:0000:0000:0000:3257:*
Résultat boolean true if IP is part of range, otherwise false.

processWithMinus() protected static méthode

Checks if an IP is part of an IP range.
protected static processWithMinus ( string $range ) : boolean
$range string IP range specified in one of the following formats: Start-End IP format: 1.2.3.0-1.2.3.255 OR 2001:cdba:0000:0000:0000:0000:3257:0001-2001:cdba:0000:0000:0000:0000:3257:1000
Résultat boolean true if IP is part of range, otherwise false.

processWithSlash() protected static méthode

Checks if an IP is part of an IP range.
protected static processWithSlash ( string $range ) : boolean
$range string IP range specified in one of the following formats: CIDR format: 1.2.3/24 OR 1.2.3.4/255.255.255.0
Résultat boolean true if IP is part of range, otherwise false.

Property Details

$ip protected_oe static_oe property

protected static $ip

$isv6 protected_oe static_oe property

protected static $isv6