8ctopus/nano-ip

experimental ip address library

0.1.2 2023-12-28 11:31 UTC

This package is auto-updated.

Last update: 2024-10-26 14:59:55 UTC


README

packagist downloads min php version license tests code coverage badge lines of code

Experimental package to check if an IPv4 ip address is in a list of ranges.

features

  • CIDR ranges

install

  • composer require 8ctopus/nano-ip

example

use Oct8pus\NanoIP\CIDR;

require_once __DIR__ . '/vendor/autoload.php';

$range = '192.168.100.0/22';

$range = new CIDRRange($range);

echo $range;
192.168.100.0/22 range contains 1024 addresses 192.168.100.0 - 192.168.103.255

Test CIDR ranges online Understand CIDR notation More info IP v6

run tests

composer test

clean code

composer fix(-risky)