- PHP 8.1+
None
Units::LENGTH_*constants have been replaced by theUnitLengthenum.LocalizedListFormatter:TYPE_*constants have been replaced by theListTypeenum.DateTimeFormatter::WIDTH_*constants have been replaced by theDateTimeFormatLengthenum.
None
- Some code is now generated from CLDR data, such as
Unitsgetters and methods.
- PHP >=7.1 <8.2
-
Support for the new plural operand
eand compact decimal exponent e.g.123c6. -
The optional parameter
data_pathtoRepository::fetch()can be used by the function to burrow in the data to fetch a target. -
CurrencyCollection::$codesreturns the list of defined currency codes. -
Support for Supplemental Currency Data Fractions:
<?php /* @var $cldr \ICanBoogie\CLDR\Repository */ $euro_fraction = $cldr->supplemental->currency_data->fraction_for('EUR'); echo $euro_fraction->digits; // 2 echo $euro_fraction->rounding; // 0 echo $euro_fraction->cash_digits; // 2 echo $euro_fraction->cash_rounding; // 0
-
PathMapperwas replaced byGitHub\UrlResolver. -
With the advent of
Fraction, the propertiesdigits,rounding,cash_digits, andcash_roundinghave been removed fromCurrency. Get them through thefractionproperty:<?php /* @var \ICanBoogie\CLDR\Currency $currency */ $currency->digits;
<?php /* @var \ICanBoogie\CLDR\Currency $currency */ $currency->fraction->digits;
-
Renamed
Units::format_combination()asformat_compound()to match the language used by Unicode.
None
-
Targets CLDR v41
-
As of CLDR v38, all JSON data is contained in this single repository. References and the way they are resolved internal has been updated, without breaking the public interfaces.
-
Improved documentation and moved elements from the README to the docs directory.
Requires PHP 7.1+
None
-
Numbers symbols are now represented by a
Symbolsinstance instead of an array. Methods using numeric symbols have been updated. The currency symbol is no longer added to the numeric symbols, it is now a separated parameter.<?php /* @var ICanBoogie\CLDR\CurrencyFormatter $formatter */ /* @var array $symbols */ $formatter->format($number, $pattern, $symbols);
<?php /* @var ICanBoogie\CLDR\CurrencyFormatter $formatter */ /* @var ICanBoogie\CLDR\Numbers\Symbols $symbols */ /* @var string $currencySymbol */ $formatter->format($number, $pattern, $symbols, $currencySymbol);
-
List patterns are now represented by a
ListPatterninstance instead of an array. Methods using a list pattern have been updated.<?php /* @var ICanBoogie\CLDR\ListFormatter $formatter */ /* @var array $list_pattern */ $formatter->format([ 1, 2, 3 ], list_pattern);
<?php /* @var ICanBoogie\CLDR\ListFormatter $formatter */ /* @var ICanBoogie\CLDR\Locale\ListPattern $list_pattern */ $formatter->format([ 1, 2, 3 ], list_pattern);
-
Removed
NumberPattern:$format, it was never used. -
Removed the
localized()method on entities that don't naturally require access to the repository:NumberFormatterandListFormatter. You can use$repository->locales['fr']->localize($formatter)to get a localized formatter, or thenumber_formatterandlist_formaterproperties of theLocaleobject. -
The fluent interface of units is now more on par with the rest of the API.
<?php echo $units->duration_hour(23); echo $units->duration_hour(23, $units::LENGTH_SHORT); echo $units->volume_liter->per_unit(12.345, $units->duration_hour); echo $units->volume_liter->per_unit(12.345, $units->duration_hour, $units::LENGTH_SHORT);
<?php echo $units->duration_hour(23); echo $units->duration_hour(23)->as_short; echo $units->volume_liter(12.345)->per($units->duration_hour); echo $units->volume_liter(12.345)->per($units->duration_hour)->as_short;
-
The localized currency formatter no longer supports a
$symbolsparameter. If you need to customize how a currency is formatted, create your ownSymbolsinstance and use it with a non-localized formatter e.g.$repository->format_currency(). -
The localized list formatter no longer accepts a list pattern or a type, only a type. If you need to customize how a list is formatted, create you own
ListPatterninstance and use it with a non-localized formatter e.g.$repository->format_list().
- Compatible with PHP 8.1+
- Targets CLDR v36
- Improved type annotations, including generics.