Validation of Poland specific data
PL: Ten pakiet zawiera walidatory danych używanych w Polsce (PESEL, NIP, REGON etc.)
EN :This package contains validators of data used in Poland (PESEL, NIP, REGON etc.)
Install
composer require illusionpro/validate-polish
Dostępne walidatory / Available validators:
PESEL Validation
Walidator
Dodatkowo zwraca
Usage:
use Illusionpro\ValidatePolish\Pesel;
$pesel = new Pesel($peselNumber);
$pesel->validate()
Result:
array(5) {
["isValid"]=> bool(true)
["gender"]=> string(1) "M"
["pesel"]=> string(11) "00112233445"
["birthDate"]=> array(3) {
["year"]=> string(4) "1980"
["month"]=> string(2) "12"
["day"]=> string(2) "30"
}
["error"]=> bool(false)
["errorMessage"]=> NULL
}
NIP Validation
Validator
(5260251109, 526-025-11-09, 52 60 25 11 09).
Usage:
use Illusionpro\ValidatePolish\Nip;
$nip = new Nip('526-025-11-09');
$nip->validate()
Result:
array(5) {
["isValid"]=> bool(true)
["nip"]=> string(10) "5260251109"
["error"]=> bool(false)
["errorMessage"]=> NULL
}
There are also other dictionary options available:
Usage:
use Illusionpro\ValidatePolish\Dictionary;
$provinces = Dictionary::getProvinces(); // for voivodship list
$province = Dictionary::getProvince($key); // to retrieve a specific voivodship based on the key from the list
Usage:
use Illusionpro\ValidatePolish\Dictionary;
$nfzList = Dictionary::getNfzList(); // to list NFZ branches
$singleNfz = Dictionary::getNfz($key); // to retrieve a specific NFZ branch
Result single:
Array
(
[code] => 11
[name] => Pomeranian branch of NFZ
)