setbased / rijksregisternummer
Library for handling identification numbers of the National Register of Belgium (a.k.a. Rijksregisternummer)
Installs: 148 412
Dependents: 0
Suggesters: 0
Security: 0
Stars: 11
Watchers: 5
Forks: 7
Open Issues: 0
Requires
- php: >=8.1
- setbased/exception: ^2.3.0
Requires (Dev)
- phing/phing: ^3.0.0-RC4
- phpstan/phpstan: ^1.9.14
- phpunit/phpunit: ^9.5.28
README
Detailed information about identification number of the National Register (NL: rijksregisternummer, FR: numéro de registre national) can be found at:
- https://nl.wikipedia.org/wiki/Rijksregisternummer
- https://fr.wikipedia.org/wiki/Numéro_de_registre_national
- https://www.ibz.rrn.fgov.be/fileadmin/user_upload/nl/rr/instructies/IT-lijst/IT000_Rijksregisternummer.pdf
- https://www.ibz.rrn.fgov.be/fileadmin/user_upload/fr/rn/fichier-rn/fichier-RN.pdf
Usage
Validating a national registry number
Validate check digits and whether the first digits form a valid date.
echo RijksregisternummerHelper::isValid('66041066600'); // true echo RijksregisternummerHelper::isValid('66041066601'); // false
Extract the date of birth from a registry number.
echo RijksregisternummerHelper::getBirthDay('66.64.10-666.92'); // '1966-04-10' echo RijksregisternummerHelper::getBirthDay('40.00.01-001.33'); // null
Also constructing a new Rijksregisternummer
will throw a \UnexpectedValueException
if the number is invalid.
Formatting a national registry number
Use the Helper to do simple string formatting. Invalid numbers will be returned as is.
echo RijksregisternummerHelper::format('66041066600'); // '66.04.10-666.00'
Or create an instance.
$rijksregisternummer = new Rijksregisternummer('93051822361'); echo $rijksregisternummer->humanFormat(); // '93.05.18-223.61'
Clean formatting characters from user input.
echo RijksregisternummerHelper::clean('66.04.10-666.00'); // '66041066600'
License
The project is licensed under the MIT license.