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 |
Via Composer
$ composer require cyrkulewski/personal-id-validatorThere 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'); // falsePlease see CHANGELOG for more information what has changed recently.
$ composer testPlease see CONTRIBUTING and CONDUCT for details.
If you discover any security related issues, please email cyrkulewski@gmail.com instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.