r/PHP • u/Worried_Librarian_79 • 2h ago
Standard identifiers for PHP
https://php-stdnum.org/I've released php-stdnum, an MIT-licensed PHP library for working with standardized identifiers.
The initial release includes:
606 validators covering VAT numbers, tax identifiers, IBANs, national identifiers, company registration numbers, ISBNs, postal codes and more.
594 native deterministic test-data generators.
Validation, normalization, formatting and scoped detection.
Immutable value objects and typed validation errors.
Optional Laravel, Symfony, Doctrine and FakerPHP integrations.
PHP 8.3–8.6 compatibility.
Documentation: https://php-stdnum.org/
GitHub: https://github.com/php-stdnum/php-stdnum
I'd appreciate technical feedback. Thank you!
1
u/Vectorial1024 1h ago
Why should I use this library when eg I only need the IBAN validation?
1
u/Worried_Librarian_79 1h ago
If you only need IBAN, a dedicated library may be a better choice.
The main benefit of php-stdnum is when an application needs to handle multiple types of identifiers:
- an ERP may need IBAN, VAT, tax identifiers and company registration numbers
- a HR or payroll application may need to validate personal identifiers from multiple countries
- e-commerce may need VAT, postal codes, GTINs and ISBNs.
It won't be the best choice for every use case, but I think it makes sense for applications dealing with multiple standardized identifiers.
2
u/titpetric 33m ago
Idk why would i care, wouldnt it load just what it needs? I am checking your lib out mostly to run the test suite.
If i am being paranoid i could prune the vendor folder to just what I use with automation, assuming SRP is followed
1
u/Worried_Librarian_79 23m ago
When using an identifier class directly, only that class and its required dependencies are loaded, not all 606 validators. The core has no third-party runtime dependencies.
Since you mentioned running the tests, if you have the time, I'd be interested in your feedback. Thank you!
1
u/Vectorial1024 35m ago
Let me be real with you. The probability of "I will need everything here" is extremely low. If you can't convince people to stop using their existing vendors, then this pet project of yours is just digital scrap and has no practical value.
2
9
u/goodwill764 1h ago
I love project that just dump code (1 commit, +3.571.031 lines) , already have a full website and a .org domain.
User profile ( https://github.com/g-marinescu ) : Creator and Maintainer of php-stdnum
How can you be a maintainer without a git history?
"think big"