plugowski / number_speller
There is no license information available for the latest version (1.0.1) of this package.
1.0.1
2016-08-14 12:52 UTC
Requires
- php: >=5.6
Requires (Dev)
- phpunit/phpunit: 4.8.9
This package is not auto-updated.
Last update: 2024-12-30 14:05:57 UTC
README
Something similar to NumberFormatter with NumberFormatter::SPELLOUT style. Class can spell numbers using custom locales. As additional feature, you are able to get correct word variant depends on number.
Installation
Just clone that repository or use composer:
composer require plugowski/number_speller
Usage
Basic usage looks like code below:
<?php require __DIR__ . '/vendor/autoload.php'; $speller = NumberSpeller\NumberSpellerFactory::create('pl_PL'); echo $speller->verbally(125000); // will return sto dwadzieścia pięć tysięcy
You can also use NumberSpeller::variety() method to get correct word form for current number (in Poland we got three different forms depend on number value).
<?php $speller = NumberSpeller\NumberSpellerFactory::create('pl_PL'); echo $speller->variety(2, ['jabłko', 'jabłka', 'jabłek']); // will return: jabłka
Licence
New BSD Licence: https://opensource.org/licenses/BSD-3-Clause