kiczort / polish-validator
Validators for Polish identification numbers: PESEL, NIP, REGON.
Installs: 87 473
Dependents: 5
Suggesters: 0
Security: 0
Stars: 10
Watchers: 2
Forks: 4
Open Issues: 0
Requires
- php: >=8.0
Requires (Dev)
- phpunit/phpunit: ~9.5
This package is auto-updated.
Last update: 2024-10-29 04:25:36 UTC
README
This is PHP library with validators for Polish identification numbers like: PESEL, NIP, REGON.
Installation
The recommended way to install this library is Composer.
# Install Composer curl -sS https://getcomposer.org/installer | php
Next, run the Composer command to install the latest stable version:
php composer.phar require kiczort/polish-validator
Documentation
Example of use PeselValidator:
There are PESEL numbers with errors in real word, so in case of this validator checksum checking is only for strict mode. In case of none strict mode it checks length, used chars and correctness of date of birth.
... use Kiczort\PolishValidator\PeselValidator; ... $validator = new PeselValidator(); if ($validator->isValid('123456789')) { // none strict mode ... } ... if ($validator->isValid('123456789', array('strict' => true))) { // with strict mode ... } ...
Example of use NipValidator:
... use Kiczort\PolishValidator\NipValidator; ... $validator = new NipValidator(); if ($validator->isValid('123456789')) { ... } ...
Example of use RegonValidator:
... use Kiczort\PolishValidator\RegonValidator; ... $validator = new RegonValidator(); if ($validator->isValid('123456789')) { ... } ...
Example of use PwzValidator:
... use Kiczort\PolishValidator\PwzValidator; ... $validator = new PwzValidator(); if ($validator->isValid('1234567')) { ... } ...
Bug tracking
GitHub issues. If you have found bug, please create an issue.
MIT License
License can be found here.