Skip to content

Repository files navigation

Personal Identification Number validation

Latest VersionLicenseBuild StatusCoverage StatusCode quality

PHP implementation of Personal Identification Number specification - draft 0.1, in order to validate Personal Identification Number of Romanian citizens and residents.

Install

Via Composer

$ composer require vimishor/cnp-php

Usage

useGentle\Embeddable\Date;
useVimishor\Cnp\Checksum;
useVimishor\Cnp\Cnp;
useVimishor\Cnp\County;
useVimishor\Cnp\Gender;
useVimishor\Cnp\Serial;
try {
$cnp = Cnp::fromString('2791219470034');
} catch (\Vimishor\Cnp\Exception\InvalidCnpException$e) {
// do something
}
// you can also instantiate everything yourselftry {
$cnp = newCnp(
newGender(2), Date::fromString('1979-12-19T19:10:23+00:00'), newCounty(47), newSerial(003), newChecksum(4)
);
} catch (\Vimishor\Cnp\Exception\InvalidCnpException$e) {
// do something
}

Testing

$ make test

Contributing

Please see CONTRIBUTING for details.

Security

For any security related issues, please email send an email at alex@gentle.ro instead of using the issue tracker.

License

Licensed under the MIT License - see the LICENSE file for details.

About

Personal Identification Number (Cod Numeric Personal) validation library.

Topics

Resources

Contributing

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages