Skip to content

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

License

Notifications You must be signed in to change notification settings

SetBased/php-rijksregisternummer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

74 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rijksregisternummer / Numéro de Registre National

Social Legal Release Tests Code
Gitter License Latest Stable Version Build Status
Code Coverage
Scrutinizer Code Quality

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.