kreyu/nip-validator-bundle
A Symfony bundle that adds validation for Polish NIP tax identification numbers. It integrates with Symfony’s Validator component, providing a constraint and validator to verify NIP format and checksum in forms and entities.
Architecture fit — the package is not what the brief assumes. kreyu/nip-validator-bundle is a Symfony bundle, not a Laravel package. It targets Symfony >=6.1, ships a Bundle subclass and a DI extension, and depends on symfony/validator Constraint classes (Nip, Tin). Laravel does not boot a Symfony Kernel and does not expose Symfony's constraint registry — Laravel's validator is Illuminate\Validation with its own Rule contract. The bundle therefore cannot be installed and used as-is in a Laravel application; only its underlying checksum logic is portable. This is the single most important finding for scoping.
Technical risk. Low code complexity, high supply-chain risk:
| Signal | Value | TPM read |
|---|---|---|
| Stars | 4 | Effectively unvetted by the ecosystem |
| Dependents | 0 | No production usage signal |
| Last release | 2023-03-23 | ~2.5 years stale; no Symfony 7 support confirmed |
| License | MIT | Permissive; vendoring/forking is legally clean |
| Maintainers | Single (Kreyu) | Bus factor of 1 |
The domain logic itself (Polish NIP: 10 digits, weighted checksum mod 11, reject when remainder is 10) is stable and well-specified, so staleness is a packaging risk rather than a correctness risk. The Tin constraint's semantics are less obvious from the bundle surface and need confirmation — it may be a generic alias or a genuinely different format, and misinterpreting it is a real correctness hazard.
Key questions for the maintainer/team:
Tin validate versus Nip — country scope, length, checksum?PL prefix) before checksumming, or reject non-canonical strings?Stack fit. For a Laravel target (10.x/11.x, PHP 8.1+), the bundle's framework plumbing is dead weight; the validator rules are ~50 lines of arithmetic. Two viable paths:
Illuminate\Contracts\Validation\ValidationRule implementation (NipRule, TinRule), register user-facing messages in a lang file, and add Pest/PHPUnit coverage against a corpus of valid/invalid NIPs. Cost: ~1 engineer-day. Removes the abandoned dependency entirely.symfony/validator and invoke Constraint validators manually inside a Laravel rule. Technically feasible but adds a second validation paradigm, a heavy transitive dependency, and translation-domain friction for zero benefit. Reject unless the org already standardizes on Symfony constraints.If the target is genuinely Symfony 6.1/6.2, direct composer require kreyu/nip-validator-bundle works and is the correct low-effort choice — but pin the version and treat it as a vendored fork candidate.
Compatibility. PHP 8.1+ aligns with Laravel 10/11 minimums; the symfony/validator version constraint is the friction point if bridged. No conflict with Laravel's bundled Symfony components (console, http-foundation, process, etc.) since validator is not among them.
Sequencing.
Nip vs Tin semantics, and error message copy with the business owner.Rule::when guard if the field is optional.composer.json.Maintenance. Near-zero ongoing cost once vendored — the checksum algorithm is a Polish statutory constant and does not drift. Retaining the dependency, by contrast, means inheriting an unmaintained package with one maintainer and no dependents; every future PHP/Symfony major becomes an unowned upgrade task. Vendoring is the operationally cheaper option despite the small upfront cost.
Support. No commercial support, no SLA, MIT with no warranty. Acceptable for a self-contained checksum; unacceptable as a critical-path dependency. Escalation path is "read the source," which is feasible here because the source is tiny.
Scaling. Non-issue. Validation is stateless, O(1) per field, no I/O, no allocation pressure. It will not appear in any performance profile.
Failure modes to instrument:
123-456-32-18 or PL1234563218; if the validator rejects rather than normalizes, support tickets follow. Decide normalization vs. strictness explicitly and document it in the API contract.Tin semantic drift — if the constraint is broader than NIP, using it as a drop-in may accept identifiers the downstream tax system rejects.Ramp-up. Trivial. A mid-level PHP engineer unfamiliar with the codebase can own this end-to-end within a day, provided the Nip vs Tin question is answered by someone with domain knowledge. The real onboarding cost is the Polish tax-ID domain, not the code.
How can I help you explore Laravel packages today?