vimishor / cnp-php
Personal Identification Number (Cod Numeric Personal) validation
Installs: 1 411
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 2
Open Issues: 1
Requires
- php: ~5.6|~7.0
- ext-ctype: *
- ext-mbstring: *
- gentle/embeddables: ^0.1
Requires (Dev)
- phpunit/phpunit: ~5.4
- squizlabs/php_codesniffer: ~3.0
This package is auto-updated.
Last update: 2024-11-28 20:44:27 UTC
README
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
use Gentle\Embeddable\Date; use Vimishor\Cnp\Checksum; use Vimishor\Cnp\Cnp; use Vimishor\Cnp\County; use Vimishor\Cnp\Gender; use Vimishor\Cnp\Serial; try { $cnp = Cnp::fromString('2791219470034'); } catch (\Vimishor\Cnp\Exception\InvalidCnpException $e) { // do something } // you can also instantiate everything yourself try { $cnp = new Cnp( new Gender(2), Date::fromString('1979-12-19T19:10:23+00:00'), new County(47), new Serial(003), new Checksum(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.