v3.0.0
New features
RFC 5646 language tags added by @PrinsFrank in #69
Language tags have been added. It is possible to construct a language tag from seperate parts, but much more useful is the parsing of language tags from strings:
+ LanguageTag::from('yue-HK'); // new LanguageTag(LanguageAlpha3Extensive::Yue_Chinese, regionSubtag: CountryAlpha2::Hong_Kong)
+ LanguageTag::from('yue-HK')->regionSubtag; // CountryAlpha2::Hong_Kong
+ new LanguageTag(LanguageAlpha3Extensive::Yue_Chinese, regionSubtag: CountryAlpha2::Hong_Kong);
Relation added between countries and Country Calling Cod(es) by @PrinsFrank in #81
If you have a country, it is now possible to get it's country calling prefix and the other way round:
+ CountryAlpha2::from('US')->getCountryCallingCodes(); // [CountryCallingCode::Integrated_numbering_plan]
+ CountryCallingCode::from(358)->getCountriesAlpha2(); // [CountryAlpha2::Finland, CountryAlpha2::Aland_Islands]
Relation added between countries and international call prefix(es) by @PrinsFrank in #82
International call prefixes were already added, but the relation to specific countries was not there yet. In this release it is now possible to retrieve an international call prefix for a country and the other way round:
+ CountryAlpha2::from('NL')->getInternationalCallPrefix()->value; // '00'
+ InternationalCallPrefix::from('000')->getCountries(); // [CountryAlpha2::Kenya, CountryAlpha2::Singapore, CountryAlpha2::Tanzania, CountryAlpha2::Uganda]
Methods added to create language tags from languages by @PrinsFrank in #83
With the introduction of language tags, it is now also possible to create a language tag instance from a language directly:
$language = LanguageAlpha3Terminology::from('nld')
+ $languageTag = $language->toLanguageTag();
This method has been added to LanguageAlpha2, LanguageAlpha3Bibliographic, LanguageAlpha3Terminology and LanguageAlpha3Extensive.
"getFlagEmoji" method added to country standards by @PrinsFrank in #93
It is now possible to retrieve the country flag emoji from a country:
+ CountryAlpha3::from('NLD')->getFlagEmoji(); // '🇳🇱'
This might not be displayed correctly in these release notes if you're on windows, see https://prinsfrank.nl/2021/01/25/Non-existing-flag-emojis-on-windows to make these flag emojis visible for Windows users.
Breaking changes
(See UPGRADING.md)
Removal of LanguageAlpha3Common; merged into LanguageAlpha3Bibliographic and LanguageAlpha3Terminology by @PrinsFrank in #91
LanguageAlpha3Common contained all the cases that were present in both LanguageAlpha3Bibliographic and LanguageAlpha3Terminology. That resulted in complicated type hints. For the sake of simplicity these have now been merged. All the cases that were present in the LanguageAlpha3Common enum are now also present in the LanguageAlpha3Bibliographic and LanguageAlpha3Terminology enums, and the LanguageAlpha3Common class has been removed.
This change also results in the return types of the methods on language classes 'toLanguageAlpha3Terminology' changing from an intersection type with the common class to just an instance of LanguageAlpha3Terminology or null and the 'toLanguageAlpha3Bibliographic' changing from an intersection type with the common class to just an instance of LanguageAlpha3Bibliographic or null.
To process this change, simply remove all references to the following class:
- LanguageAlpha3Common
ScriptCode and ScriptNumber naming inverted
In the previous release 2.5.0, the naming for scriptCode and ScriptNumber were swapped. In this release the naming has been fixed. If you used any of these classes already, please swap them in your code as well:
- ScriptCode
+ ScriptName
- ScriptName
+ ScriptCode
Typo fixed in CountryCallingCode enum case by @szepeviktor in #65
A typo in the name of Global Mobile Satellite System has been fixed. If you were using the Global_Mobile_Satelite_System_shared_code
case of CountryCallingCode as a hardcoded value in your codebase, you schould change it: (Note the extra letter 'l')
- CountryCallingCode::Global_Mobile_Satelite_System_shared_code;
+ CountryCallingCode::Global_Mobile_Satellite_System_shared_code;
BackedEnum and UnitEnum are now marked internal @PrinsFrank in #92
These classes should not be used outside of this package, as the method signature might change between minor versions. As such, these classes are now marked internal. If you use the classes in your code you can continue to do so at your own risk, or you might want to remove their usages.
Other
- Do not distribute PNG images by @szepeviktor in #79
- Speed up PHPStan execution by @szepeviktor in #89
- Fix PHPStan usage by @szepeviktor in #88
- Synchronize PHPStan usage by @szepeviktor in #90
- Update documentation for languages by @PrinsFrank in #94
Full Changelog: v2.5.0...v3.0.0