r/PHP • • 17h 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!

10 Upvotes

12 comments sorted by

26

u/goodwill764 16h ago • Bravo

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"

4

u/Worried_Librarian_79 16h ago

Perhaps I made a mistake by not publishing the Git history.

The project was developed over... many months, with architectural changes, discarded approaches and multiple iterations. I chose to publish 0.1.0 as a clean initial commit, thinking it would make the project easier to navigate and understand. The validation rules, sources, design, tests and known limitations are all documented.

This is my first open-source library, so I'm learning about open-source development practices. I will try to pay more attention to open-source release etiquette in the future.

Thank you for the feedback!

5

u/goodwill764 16h ago

"I chose to publish 0.1.0 as a clean initial commit, thinking it would make the project easier to navigate and understand."

I navigate in most projects from file to file to understand it and for deeper understanding i looking in the history of the code.

Now it looks like a AI dump and I dont care about AI, but why should anyone should give you technical feedback if you cut part of the history?

"The validation rules, sources, design, tests and known limitations are all documented."

Looks/feels like AI written, did you read it all?

And its fine if you made a cut, but then you should let it grow again before you ask for feedback.

0

u/divinecomedian3 8h ago

but why should anyone should give you technical feedback if you cut part of the history?

History has to start somewhere. I think a new repo having a bunch of commits is just noise.

3

u/Vectorial1024 16h ago

Why should I use this library when eg I only need the IBAN validation?

3

u/Worried_Librarian_79 15h 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 15h 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 15h 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!

2

u/Vectorial1024 15h 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.

3

u/HumbleCan6392 10h ago

I would rather use a specific library for my usecase like https://github.com/Fale/isbn instead of some vibecoded

1

u/Worried_Librarian_79 9h ago

I was curious about the comparison, so I tested fale/isbn 3.1.0 and php-stdnum 0.1.0.

I respect the work that went into fale/isbn, which has over 500,000 installs. However, there are correctness issues:

- It accepts 9520123456788, a non-book GTIN, as a valid ISBN-13 (https://ref.gs1.org/standards/digital-link/uri-syntax/1.7.0/#gtin)

- It accepts 9790345246805, which is an ISMN, not an ISBN (https://ismn-international.org/ismn/ranges/)

- It converts 9798891790612 to ISBN-10, although the International ISBN Agency explicitly states that ISBNs starting with 979 have no ISBN-10 equivalent (https://www.isbn-international.org/content/changes-united-states-isbn-prefixes)

Thanks for suggesting the comparison.

0

u/joseph-edmondscomm 15h ago

thanks for sharing 😄