cyrkulewski / personal-id-validator
Library to validate personal IDs of different countries.
Requires
- php: ~5.5|~7.0
Requires (Dev)
- phpunit/phpunit: ~4.0
- scrutinizer/ocular: ~1.1
- squizlabs/php_codesniffer: ~2.3
This package is auto-updated.
Last update: 2024-04-29 03:07:15 UTC
README
Library to validate personal IDs of different countries. Most of the countries in the world assign certain ID to each citizen. This library helps to validate it. One just need to pass ID and country short-name (in ISO 3166-1 alpha-2 standard) to the validator.
Supported countries (in alphabetical order):
Country code | Country name | Personal ID name |
---|---|---|
DE | Germany | Steueridentifikationsnummer |
DK | Denmark | CPR-nummer |
FI | Finland | HETU |
FR | France | Numéro de sécurité sociale (INSEE) |
PL | Poland | PESEL |
SE | Sweden | Personnumer |
Install
Via Composer
$ composer require cyrkulewski/personal-id-validator
Usage
There is one public function used for validation. It will return boolean. One need to pass ID to check and country code.
$validator->validate('ID', 'COUNTRY');
use cyrkulewski\PIdV\Dictionary\CountryDictionary; use cyrkulewski\PIdV\PIdValidator; $validator = new PIdValidator(); $validator->validate('197704190011', CountryDictionary::SWEDEN); // true $validator->validate('311280-888Y', CountryDictionary::FINLAND); // true $validator->validate('abcdef', CountryDictionary::DENMARK); // false $validator->validate('197704190011', 'NON-SUPPORTED-COUNTRY'); // false
Change log
Please see CHANGELOG for more information what has changed recently.
Testing
$ composer test
Contributing
Please see CONTRIBUTING and CONDUCT for details.
Security
If you discover any security related issues, please email cyrkulewski@gmail.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.