r/webdev • • 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

8 comments sorted by

View all comments

3

u/jhartikainen 1h 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.

1

u/Worried_Librarian_79 49m ago

The library distinguishes between structural validation and existence verification.

Structural validation goes beyond pattern matching. Depending on the identifier, it checks length, format, checksums, valid component ranges, dates and country-specific rules.

However, you are right that passing these checks does not prove that an identifier has actually been issued, is currently registered or belongs to a particular person or company.

For EU VAT numbers, the library provides optional online verification through VIES.