arius/number-formatter

Extended PHP NumberFormatter class.

v1.1.0 2015-11-11 10:47 UTC

This package is auto-updated.

Last update: 2024-03-29 02:31:10 UTC


README

Build Status Coverage Status SensioLabsInsight

PHP NumberFormatter extended with additional ordinals not supported by ICU.

Feel free to add more languages. Fork, pull request and contribute!

How to

  1. composer.json
{
     "require": {
        "arius/number-formatter": "1.*"
     }
}
  1. PHP

Use in code just like NumberFormatter class.

use Arius\NumberFormatter;

$formatter = new NumberFormatter('pl', NumberFormatter::SPELLOUT);
$formatter->setTextAttribute(NumberFormatter::DEFAULT_RULESET, "%spellout-ordinal");

$formatter->format(123);

Additional supported ordinals

  1. Polish (pl)
  • spellout-ordinal
  • spellout-ordinal-feminine
  • spellout-ordinal-masculine
  • spellout-ordinal-neuter
  1. Russian (ru)
  • spellout-ordinal
  • spellout-ordinal-feminine
  • spellout-ordinal-masculine
  • spellout-ordinal-neuter
  • spellout-ordinal-plural (plural isn't part of ICU in all languages)