Skip to content

Releases: lhcze/bcp47-tag

2.0.0 New interface, value objects, exceptions & more

13 Jul 22:24
13d5228

Choose a tag to compare

Refactor BCP47Tag library to give better results, understandable interface, exception and performace

  • Refactored BCP47Tag class, changed class construction signature.
  • Replaced $knownTags and $requireCanonical arguments with $useCanonicalMatchTags array
  • Refactored the internals during construction of the object to better handle fallback, normalization and validation (including fallback and useCanonicalMatchTags array)
  • added public interface getLanguageTag(): LanguageTag method so you can work with even easier value object in your code base,
    useCanonicalMatchTags is now using scoring system to match the resolved language tag to provided list
  • ParsedTag value object is now Stringable and JsonSerializable
  • Introducing LanguageTag— an immutable value object that can be created only via it's own factory method and extending ParsedTag so it's also stringable and json serializable
  • BCP47Normalizer now uses auto-generated GrandfatheredTag enum to detect grandfathered tags
  • Few modifications to BCP47Parser to more readable, throw exceptions, and handle grandfathered tags correctly
  • Few modifications to IanaSubtagRegistry to throw exceptions, added TODO list what is missing and made code more readable
  • Resource file is now static php array instead of json file
  • Resource file compilation how expands range tags into individual tags/subtags, uses utility function expandAlphaRangeFunction()
  • Made Exception classes with a logical flow in case something goes wrong
  • Added phpstan/phpstan-strict-rules into composer
  • Added composer iana:refresh to fetch and compile fresh source of data
  • Some more...

This version if far more ready to work great on production environments for 99.8% of the cases that might be needed :) While I still see the joy to work towards the goal to make the 0.2% happy as well (flex)

1.0.1 Switch to static PHP IANA registry, remove symfony/intl, optimize lazy loading and add git workflow with QA tools run

11 Jul 22:16
d2bf840

Choose a tag to compare

  • Replaced JSON IANA registry with static PHP snapshot for zero parsing overhead
    -Removed symfony/intl and validator dependency (not needed after refactor). Remnant of the original thoughts.
  • I mplemented singleton lazy loader for registry (friend of OPcache)
  • Updated composer with iana:refresh script for manual IANA updates
  • Cleaned up normalizer logic (pure ABNF-based, no external fallback)
  • Updated README to reflect new structure and performance design
  • All tests green, code lighter, faster, and fully self-contained. Ready to handle more serious loads.
  • Create git workflow with php.yml
  • Added getICULocale() instead of getUnderscored()
  • Marked methods getLC(), getUC() , getLCU() and getUCU() as internal (however, you can still use them if you're in lazy mode)
  • Added git workflows to run the build and QA tests
  • Updated tests

1.0.0

10 Jul 01:24
36b5827

Choose a tag to compare

What's Changed

  • Initial version of BCP47 by @lhcze in #1

New Contributors

  • @lhcze made their first contribution in #1

Full Changelog: https://github.com/lhcze/bcp47-tag/commits/1.0.0

@see README.md to get the idea