arius / number-formatter
Extended PHP NumberFormatter class.
Installs: 7 212
Dependents: 0
Suggesters: 0
Security: 0
Stars: 14
Watchers: 3
Forks: 4
Open Issues: 0
Requires
- php: >=5.4
- ext-intl: >=1.0
Requires (Dev)
- phpunit/phpunit: 4.0.*
- satooshi/php-coveralls: dev-master
This package is auto-updated.
Last update: 2025-01-29 04:12:46 UTC
README
PHP NumberFormatter extended with additional ordinals not supported by ICU.
Feel free to add more languages. Fork, pull request and contribute!
How to
- composer.json
{ "require": { "arius/number-formatter": "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
- Polish (pl)
- spellout-ordinal
- spellout-ordinal-feminine
- spellout-ordinal-masculine
- spellout-ordinal-neuter
- 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)