Skip to content

Releases: johnnyxlemonade/component_postcode

Release 3.0.0: CountryCode enum migration

01 Oct 20:05

Choose a tag to compare

[3.0.0] - 2025-10-02

Added

  • CountryCode enum replacing raw string codes.
  • FormatterRegistry redesigned to be immutable (register() returns a new instance).
  • FormatterRegistry::all() method for inspecting registered formatters.
  • Full PHPUnit test coverage for registry immutability and enum integration.

Changed

  • BC BREAK: All methods now expect CountryCode instead of string country codes.
  • BC BREAK: FormatterRegistry no longer has static state – must be instantiated and passed into PostcodeFormatter.
  • PostcodeFormatter now requires a FormatterRegistry instance in its constructor.

Fixed

  • Clearer distinction between UnknownCountryException and UnsupportedCountryException.
  • Improved error messages with translation keys (error.invalid_postcode, error.unknown_country, error.unsupported_country).

Tests

  • ✅ Full PHPUnit coverage (100%).
  • ✅ PHPStan Level 10 + Strict Rules passing with 0 errors.

Release v2.0.0 - PostcodeFormatter, FormatterRegistry improvements, PHPStan Level 10 + Strict Rules integration, tests, and bug fixes

01 Oct 07:32

Choose a tag to compare

Added

  • Input normalization for postal codes (handles hyphens, spaces).
  • FormatterRegistry supports overwriting existing formatters (withAdded()).
  • Comprehensive integration tests for postcode formatting, including edge cases.
  • PHPStan Level 10 + Strict Rules configuration for static analysis.

Changed

  • BC BREAK: FormatterRegistry::get() now throws UnknownCountryException instead of returning null.
  • Most formatters refactored to use PostcodeValidationTrait.
  • Improved exception messages and strict preg_match validation.

Fixed

  • Missing imports for functions (substr, str_starts_with, preg_match, etc.) in several formatters.
  • Correct handling of UnknownCountryException during lookups.

Tests

  • Full PHPUnit test suite for PostcodeFormatter and FormatterRegistry.
  • Integration tests for normalization and invalid input handling.
  • Integrated PHPStan static analysis with strict rules (Level 10)

Lemonade Postcode v1.0.0 – Initial release

30 Sep 21:22
149532f

Choose a tag to compare

First stable release with PostcodeFormatter, country-specific formatters,
exception-based validation and Composer integration.