Download the PHP package brianlmoon/php-safelist-check without Composer
On this page you can find all versions of the php package brianlmoon/php-safelist-check. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download brianlmoon/php-safelist-check
More information about brianlmoon/php-safelist-check
Files in brianlmoon/php-safelist-check
Package php-safelist-check
Short Description Provides a simple way to check whether an address or domain is on a safelist
License BSD-2-Clause
Homepage https://github.com/brianlmoon/php-safelist-check
Informations about the package php-safelist-check
php-safelist-check
This is a fork of https://github.com/Jalle19/php-whitelist-check to change hidden bias terminology.
A modern and simple approach to validating IP addresses and domains against a safelist. It supports both IPv4 and IPv6 addresses and CIDR subnets in addition to domain names and wild-card domains.
Requirements
- PHP 5.3 or newer
Usage
The Check::safelist()
method takes an array of definitions which will constitute the safelist. 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 safelist. The method will return true if the value matches any of the definitions.
To create your own definition classes just extended Safelist\Definition\Definition
and implement Safelist\Definition\IDefinition
Example usage:
License
This library is licensed under the BSD 2-Clause License
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.