webmozarts / assert

Assertions to validate method input/output with nice error messages.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Suggestion to Assert some ISO standards

leroy0211 opened this issue · comments

Would it be an idea to assert some ISO standards, like:

  • 639-2 (2 letter language code)
  • 639-1 (3 letter language code)
  • 3166-1 (country codes)

Or would this be out-of-scope of this library?

Is there a way to do this assertion without adding a dependency, and without keeping a big list of all the possilbe land codes?

I don't think so. The intl extension or symfony/intl replacement could be used for this.
And to keep this library as lean as possible, the packages can always be a composer suggestion.

# composer.json
{
    ...
    "suggest": {
        "symfony/intl": "Allows you to validate language codes, country codes, ..."
    }
    ...
}

I was thinking the same for currency codes and wondering if there has been any discussion already in the past...landed here :) Would this be something useful to work on or not adding too much value?

Is there a way to do this assertion without adding a dependency, and without keeping a big list of all the possilbe land codes?

I've been thinking about this. But it might be possible to create a different repository to add additional features, for example a package webmozart/assert-i18n which will be suggested in webmozart/assert to prevent additional libraries or additional lists to be added in this library.

I think there are other projects that deal with ISO country code standards. I don't think it should be added to this proejct.