Releases: PrinsFrank/standards
v1.3.0 Expand BackedEnum utility class with ::names, ::values and ::toArray
What's Changed
Full Changelog: v1.2.0...v1.3.0
v1.2.0 Added Country calling codes
v1.1.0 Turkiye rename & lots of new features
What's Changed
Turkey, Türkiye and BC key changes.
A new minor version is released as Turkey has now officially been renamed to Türkiye in ISO3166.
This brought one major challenge though; Renaming enum names are breaking changes, and releasing a new major version for every country rename is not ideal and leaves a lot of overhead for package users. Therefor, a new enum is added with the latest name for countries, currencies and languages, that can be used instead of enum keys. Keys will not change to keep this package backwards compatible:
/**
* @source https://www.iso.org/obp/ui/#search/code/
*/
enum ISO3166_1_Name: string
{
case Turkey = 'Türkiye';
// Enum key is unchanged to be backwards compatible
}
Methods are added to get the name corresponding to alpha2, alpha3 and numeric values:
$turkiye = ISO3166_1_Alpha_2::fromValue('TR');
$name = $turkiye->toISO3166_Name()->value(); // Türkiye
Helper methods for casing and numeric values as integers
All alpha2 and alpha3 values in ISO3166 and ISO4127 are uppercase, and lowercase in ISO639. You may want to get them as lowercase and uppercase respectfully. Methods to get these values are now available:
$netherlands = ISO3166_1_Alpha_2::fromValue('NL');
$netherlandsLowerCase = $netherlands->lowerCaseValue(); // nl
$dutchFlemish = ISO639_1_Alpha_2::fromValue('nl');
$dutchFlemishUpperCase = $dutchFlemish->upperCaseValue(): // NL
Numeric enums sometimes have leading zeros that are required as their complete value. You may want to get those values as integers though;
$euro = ISO4217_Numeric::fromValue('978');
$euro = ISO4217_Numeric::fromInt(978);
$euroAsInt = $euro->valueAsInt(): // 978
Other changes
Apart from these changes, a lot has been done to improve this package's stability and make this package more mature;
- Name Composer scripts like $tool:$action by @szepeviktor in #14
- Fix Composer script in CI by @szepeviktor in #16
- Run unit tests in CI by @szepeviktor in #17
- Add phpstan by @PrinsFrank in #21
- Simplify BackedEnum by @szepeviktor in #23
- Convert key variance to new enum to prevent many major releases by @PrinsFrank in #26
- Add code coverage generation by @PrinsFrank in #30
Full Changelog: v1.0.0...v1.1.0
v1.0.0 - First stable release
What's Changed
With version 1.0.0, this package is now stable! As the standards are now pulled daily from their respective sources, this package will be updated as soon as their counterpart spec updates! Unfortunately, when pulling from the official sources it became apparent that the 0.0.1 release contained several enum keys that were not consistent with the official spec. make sure to follow the upgrade guide to implement these changes and get up and running with this new release!
- Add .gitattributes by @lakuapik in #6
- Small fixes by @akalineskou in #5
- Rename ISO4217_Alpha3 to ISO4217_Alpha_3 by @Wick96 in #3
- HTTP Status Codes (iana) by @irealworlds in #4
- Add automatic spec updating by @PrinsFrank in #9, #10 and #11
- Run SpecUpdater in a Composer way by @szepeviktor in #13
New Contributors
- @lakuapik made their first contribution in #6
- @akalineskou made their first contribution in #5
- @Wick96 made their first contribution in #3
- @irealworlds made their first contribution in #4
- @szepeviktor made their first contribution in #13
Full Changelog: v0.0.1...v1.0.0