setbased/rijksregisternummer

Library for handling identification numbers of the National Register of Belgium (a.k.a. Rijksregisternummer)

1.4.0 2023-01-26 04:27 UTC

This package is auto-updated.

Last update: 2024-10-26 08:11:30 UTC


README

Detailed information about identification number of the National Register (NL: rijksregisternummer, FR: numéro de registre national) can be found at:

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.