{"id":16485574,"url":"https://github.com/jalle19/php-whitelist-check","last_synced_at":"2025-04-10T05:10:49.755Z","repository":{"id":13115268,"uuid":"15797004","full_name":"Jalle19/php-whitelist-check","owner":"Jalle19","description":"Very light-weight library for checking if a client is on a whitelist","archived":false,"fork":false,"pushed_at":"2023-08-31T11:59:25.000Z","size":59,"stargazers_count":40,"open_issues_count":0,"forks_count":19,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-03T01:12:59.371Z","etag":null,"topics":["cidr","php","whitelist"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Jalle19.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2014-01-10T11:58:02.000Z","updated_at":"2024-11-13T14:02:48.000Z","dependencies_parsed_at":"2023-09-23T18:14:45.874Z","dependency_job_id":null,"html_url":"https://github.com/Jalle19/php-whitelist-check","commit_stats":{"total_commits":65,"total_committers":8,"mean_commits":8.125,"dds":0.5692307692307692,"last_synced_commit":"4c8565362d00ea9321c81a9d599b17fcd7665b6f"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jalle19%2Fphp-whitelist-check","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jalle19%2Fphp-whitelist-check/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jalle19%2Fphp-whitelist-check/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jalle19%2Fphp-whitelist-check/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Jalle19","download_url":"https://codeload.github.com/Jalle19/php-whitelist-check/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248161274,"owners_count":21057555,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cidr","php","whitelist"],"created_at":"2024-10-11T13:26:18.792Z","updated_at":"2025-04-10T05:10:49.735Z","avatar_url":"https://github.com/Jalle19.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![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)\n[![Coverage Status](https://coveralls.io/repos/github/Jalle19/php-whitelist-check/badge.svg?branch=master)](https://coveralls.io/github/Jalle19/php-whitelist-check?branch=master)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/Jalle19/php-whitelist-check/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/Jalle19/php-whitelist-check/?branch=master)\n\nphp-whitelist-check\n===================\n\nA 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.\n\n## Requirements\n\n* PHP 5.3 or newer\n\n## Usage\n\nThe `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.\n\nThe `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.\n\nTo create your own definition classes just extended `Whitelist\\Definition\\Definition` and implement `Whitelist\\Definition\\IDefinition`\n\nExample usage:\n\n```php\nrequire_once(\"vendor/autoload.php\");\n\n$checker = new Whitelist\\Check();\n\ntry {\n\t$checker-\u003ewhitelist(array(\n\t\t'10.0.3.1',\n\t\t'10.0.0.0/16',\n\t\t'2001:db8:100:934b::3:1',\n\t\t'2001:db8:100:934b::/64',\n\t\t'*.example.com',\n\t\t'localhost',\n\t\tnew Whitelist\\Definition\\Domain('vpn.work.com'),\n\t));\n}\ncatch (InvalidArgumentException $e) {\n\t// thrown when an invalid definition is encountered\n}\n\n$checker-\u003echeck('10.0.1.1'); // true\n$checker-\u003echeck('10.1.1.1'); // false\n$checker-\u003echeck('2001:db8:100:934b::210:2'); // true\n$checker-\u003echeck('another.example.com'); // true\n\n```\n\n## License\n\nThis library is licensed under the BSD 2-Clause License\n\n## Credits\n\nThis 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.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjalle19%2Fphp-whitelist-check","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjalle19%2Fphp-whitelist-check","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjalle19%2Fphp-whitelist-check/lists"}