PHPackages                             jalle19/php-whitelist-check - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. jalle19/php-whitelist-check

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

jalle19/php-whitelist-check
===========================

Provides a simple way to check whether an address or domain is on a whitelist

1.2.0(2y ago)45778.7k—2.7%184BSD-2-ClausePHPPHP &gt;=5.5.2CI failing

Since Feb 3Pushed 2y ago6 watchersCompare

[ Source](https://github.com/Jalle19/php-whitelist-check)[ Packagist](https://packagist.org/packages/jalle19/php-whitelist-check)[ Docs](https://github.com/Jalle19/php-whitelist-check)[ RSS](/packages/jalle19-php-whitelist-check/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (11)Used By (4)

[![Run test suite](https://github.com/Jalle19/php-whitelist-check/actions/workflows/tests.yml/badge.svg)](https://github.com/Jalle19/php-whitelist-check/actions/workflows/tests.yml)[![Coverage Status](https://camo.githubusercontent.com/3803dcca100837d7b6e68f457a59d67726cc1c09ec3e2b6da743e9664541c8de/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f4a616c6c6531392f7068702d77686974656c6973742d636865636b2f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/Jalle19/php-whitelist-check?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/399176994513f8dae75bedd3baf38c4e05db741a97204a495b997ebf28727c36/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4a616c6c6531392f7068702d77686974656c6973742d636865636b2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Jalle19/php-whitelist-check/?branch=master)

php-whitelist-check
===================

[](#php-whitelist-check)

A modern and simple approach to validating IP addresses and domains against a whitelist. It supports both IPv4 and IPv6 addresses and CIDR subnets in addition to domain names and wild-card domains.

Requirements
------------

[](#requirements)

- PHP 5.3 or newer

Usage
-----

[](#usage)

The `Check::whitelist()` method takes an array of definitions which will constitute the whitelist. The definitions can either be strings (which will be parsed to their respective objects) or objects.

The `Check::check($value)` method is used to check the specified value against the current whitelist. The method will return true if the value matches any of the definitions.

To create your own definition classes just extended `Whitelist\Definition\Definition` and implement `Whitelist\Definition\IDefinition`

Example usage:

```
require_once("vendor/autoload.php");

$checker = new Whitelist\Check();

try {
	$checker->whitelist(array(
		'10.0.3.1',
		'10.0.0.0/16',
		'2001:db8:100:934b::3:1',
		'2001:db8:100:934b::/64',
		'*.example.com',
		'localhost',
		new Whitelist\Definition\Domain('vpn.work.com'),
	));
}
catch (InvalidArgumentException $e) {
	// thrown when an invalid definition is encountered
}

$checker->check('10.0.1.1'); // true
$checker->check('10.1.1.1'); // false
$checker->check('2001:db8:100:934b::210:2'); // true
$checker->check('another.example.com'); // true
```

License
-------

[](#license)

This library is licensed under the BSD 2-Clause License

Credits
-------

[](#credits)

This library depends on `xrstf/ip-utils` for the IP-related functionality. It also assumes that ip-utils's test cases are sufficient, which is why only trivial testing on these functions have been made for this library.

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity51

Moderate usage in the ecosystem

Community24

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 84.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~388 days

Recently: every ~722 days

Total

10

Last Release

992d ago

PHP version history (2 changes)1.0.0PHP &gt;=5.3.0

1.2.0PHP &gt;=5.5.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/d7e28ec3bf2ff3ffcdd8c947f54d53d4dae86939bea2a7316cfde0b10410e9ee?d=identicon)[Jalle19](/maintainers/Jalle19)

---

Top Contributors

[![Jalle19](https://avatars.githubusercontent.com/u/1106133?v=4)](https://github.com/Jalle19 "Jalle19 (45 commits)")[![coquer](https://avatars.githubusercontent.com/u/1929689?v=4)](https://github.com/coquer "coquer (5 commits)")[![digitalfiz](https://avatars.githubusercontent.com/u/157699?v=4)](https://github.com/digitalfiz "digitalfiz (2 commits)")[![Zae](https://avatars.githubusercontent.com/u/96126?v=4)](https://github.com/Zae "Zae (1 commits)")

---

Tags

cidrphpwhitelistipv6ipv4cidrwhitelist

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jalle19-php-whitelist-check/health.svg)

```
[![Health](https://phpackages.com/badges/jalle19-php-whitelist-check/health.svg)](https://phpackages.com/packages/jalle19-php-whitelist-check)
```

###  Alternatives

[s1lentium/iptools

PHP Library for manipulating network addresses (IPv4 and IPv6)

2446.2M24](/packages/s1lentium-iptools)[markrogoyski/ipv4-subnet-calculator

Network calculator for subnet mask and other classless (CIDR) network information.

177813.7k6](/packages/markrogoyski-ipv4-subnet-calculator)[rlanvin/php-ip

IPv4/IPv6 manipulation library for PHP

180738.8k11](/packages/rlanvin-php-ip)[tholu/php-cidr-match

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

37211.1k](/packages/tholu-php-cidr-match)[longman/ip-tools

PHP IP Tools for manipulation with IPv4 and IPv6

147245.6k6](/packages/longman-ip-tools)[jaaulde/php-ipv4

PHP classes for working with IPV4 addresses and networks.

1034.6k](/packages/jaaulde-php-ipv4)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
