Skip to content

Numerik

Validate and parse Polish identification numbers with rich value objects and detailed error reasons.

Numerik is a zero-dependency PHP 8.3+ library. Validation tells you why input failed, not just that it failed.

PESEL

Validates and parses Poland’s universal citizen identifier. Extracts birth date, gender, century, age, and ordinal number directly from the number.

ID Card

Validates Polish national identity card numbers (dowód osobisty). Three-letter series plus six digits, validated with the ICAO 9303 weighted checksum.

Passport

Validates Polish passport numbers. Two-letter series plus seven digits, validated with the same ICAO 9303 algorithm used in travel documents globally.

NIP

Validates tax identification numbers for individuals and legal entities. Returns the issuing tax office code and formatted display form.

VAT-EU

Validates intra-EU VAT numbers for Polish taxpayers (PL + NIP). Strips the country prefix and applies the NIP MOD-11 algorithm. Returns the NIP and formatted display form.

REGON

Handles both 9-digit (individual) and 14-digit (legal entity with local unit) REGON numbers, including multi-stage checksum validation.

KRS

Validates court register numbers with automatic zero-padding normalisation. Documents the offline vs. online verification limitation.

NRB

Validates Polish bank account numbers using the MOD-97 checksum. Accepts raw, spaced, and IBAN (PL-prefixed) formats. Returns sort code, bank code, and account number.

IBAN

Validates Polish IBANs (PL + NRB). Requires the country prefix and applies MOD-97. Returns NRB, sort code, bank code, and account number.

Laravel

Drop-in Laravel validation rules for all identifiers via slashlab/numerik-laravel. Supports class-based and string-based syntax, with strict-mode control for PESEL.

use SlashLab\Numerik\Numerik;
// Simple boolean check
Numerik::pesel()->isValid('92060512186'); // true
Numerik::nip()->isValid('5260250274'); // true
// Rich result with failure details
$result = Numerik::pesel()->validate('92060512185'); // wrong checksum digit
$result->isFailed(); // true
$result->getFirstFailure()->reason; // ValidationFailureReason::InvalidChecksum
// Parse to a value object
$pesel = Numerik::pesel()->parse('92060512186');
$pesel->getBirthDate()->format('Y-m-d'); // '1992-06-05'
$pesel->getGender(); // Gender::Female
$pesel->getAge(); // calculated from today
$pesel->isAdult(); // true
  • Zero production dependenciesrequire only php: ^8.3.
  • Immutable value objects — all value objects are readonly classes.
  • Strict types everywheredeclare(strict_types=1) in every file.
  • Rich failure reasonsValidationFailureReason enum covers format, checksum, encoded-date, and semantic failures.
  • No regular expressions for validation logic — all checks are digit-array operations safe from ReDoS.
  • Input length guard — inputs over 32 characters are rejected immediately.
If this saved you time → ☕ Buy me a coffee