tholu/php-cidr-match

CIDRmatch is a library to match an IP to an IP range in CIDR notation (IPv4 and IPv6).

Maintainers

Package info

github.com/tholu/php-cidr-match

pkg:composer/tholu/php-cidr-match

Statistics

Installs: 208 739

Dependents: 1

Suggesters: 0

Stars: 35

Open Issues: 0

0.6 2026-03-03 12:48 UTC

This package is not auto-updated.

Last update: 2026-03-12 10:13:57 UTC


README

CI

CIDR match

CIDRmatch is a library to match an IP to an IP range in CIDR notation (IPv4 and IPv6).

NOTE: Symfony2 already does everything this library here does with its IpUtils module. Unfortunately I discovered this only after I finished working on this library.

Usage

$cidrMatch = new CIDRmatch();
$cidrMatch->match($ip, $cidr);

Tests

./vendor/bin/phpunit tests/CIDRmatchTest