r/webdev • u/Worried_Librarian_79 • 1h ago
Standard identifiers for PHP
https://php-stdnum.org/I've released an open-source PHP library for validating, normalizing and generating standardized identifiers.
It covers 606 identifier types - VAT numbers, IBANs, company registration numbers, national identifiers and postal codes.
It also includes 594 test-data generators and optional integrations with Laravel, Symfony, Doctrine and FakerPHP.
Documentation and searchable catalogue: https://php-stdnum.org/
Source code: https://github.com/php-stdnum/php-stdnum
Feedback is welcomed.
Thank you!
0
Upvotes
3
u/jhartikainen 54m ago
I'm not sure how you're claiming to validate VAT IDs and such, when these numbers are on a per-registration basis. Just because the number is valid by pattern doesn't mean it's actually valid.
4
u/Hopeful-Recording705 57m ago
606 identifier types. Six hundred. Who is sitting there writing the validator for the Andorran NRT at 2am and thinking yeah this is the thing that was missing from the ecosystem. and 594 generators, so basically 594 of those 606 exist so you can generate fake data to test the validators you just wrote, which validate the fake data. its a circle. meanwhile every one of these libs dies the same death, the checksum for some Costa Rican tax id changes in 2027 and nobody merges the PR and suddenly your checkout form rejects real customers. ive seen it, we had a library like this at a job and half the country validators were just wrong, someone had copy pasted the regex from stackoverflow with the comment "works for now". so congrats on the catalogue i guess, but the day you stop maintaining it is the day it becomes a liability, and nobody warns you about that in the readme. also "deterministic generators" is such a weird thing to advertise as a feature. generators should be deterministic? thats not a feature thats the definition.