lamoni/ipsuite

PHP utilities for dealing with IPv4 and IPv6 addresses

v1.0.0 2015-02-09 07:40 UTC

This package is not auto-updated.

Last update: 2024-12-17 04:38:08 UTC


README

PHP utilities for dealing with IPv4 and IPv6

Examples

echo IPSuite::GetIPv4NetworkAddress("192.168.0.1/24"); // 192.168.0.0

echo IPSuite::NormalizeIPv6Address("::1"); // 0000:0000:0000:0000:0000:0000:0000:0001

if (IPSuite::IsIPv4SubnetWithinSupernet("192.168.0.0/24", "192.168.0.0/16")) {
    echo "Yes!";
}
else {
    echo "Nope!";
}

if (IPSuite::IsIPv4AddressWithinSubnet("192.168.0.100", "192.168.0.0/24")) {
    echo "Yes!";
}
else {
    echo "Nope!";
}