1. Go to this page and download the library: Download pinoox/numera library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
pinoox / numera example snippets
use Pino\Numera;
echo Numera::init('en')->n2w(1234);
echo Numera::init('fa')->n2w('۱۲۳۴');
echo Numera::init('en')->toYear(2024);
'default_locale' => 'en', // or fa, de, fa-IR, …
'fallback_locale' => 'en',
use Pinoox\Numera\Laravel\Facades\Numera;
echo Numera::n2w(1234);
echo Numera::toYear(2024);
echo Numera::setLocale('fa')->n2w(-500);
use Pino\Numera;
$numera = Numera::init('en'); // Initialize with English locale
$result = $numera->convertToWords(4454545156);
echo $result; // Output: "four billion, four hundred fifty-four million, five hundred forty-five thousand, one hundred fifty-six"
$result = $numera->n2w('4,454,545,156');
echo $result; // Output: "four billion, four hundred fifty-four million, five hundred forty-five thousand, one hundred fifty-six"
echo Numera::init('en')->n2w(3.14); // three point one four
echo Numera::init('en')->n2w('1,250.75'); // one thousand, two hundred fifty point seven five
echo Numera::init('fa')->n2w(3.14); // سه ممیز یک چهار
$numera = Numera::init('en');
echo $numera->toOrdinal(21); // twenty-first
echo $numera->n2o(100); // one hundredth
$numera->setLocale('fa');
echo $numera->toOrdinal(3); // سوم
echo $numera->toOrdinal(21); // بیست و یکم
echo Numera::init('en')->toCurrency(1250.50, 'USD');
// one thousand, two hundred fifty dollars and fifty cents
echo Numera::init('fa')->toCurrency(150000, 'IRR');
// صد و پنجاه هزار ریال
echo Numera::init('en')->toCurrency(3.01, 'GBP');
// three pounds and one penny
echo Numera::init('en')->withUnit(1, 'kg'); // one kilogram
echo Numera::init('en')->withUnit(5, 'hour'); // five hours
echo Numera::init('fa')->withUnit(1, 'day'); // یک روز
// Persian → English
echo Numera::init('fa')->translateTo('en', 'دویست و یک'); // two hundred one
echo Numera::init('fa')->translateTo('en', 'شنبه'); // saturday
// English → Persian
echo Numera::init('en')->translateTo('fa', 'two hundred one'); // دویست و یک
echo Numera::init('en')->t2t('monday', 'fa'); // دوشنبه
LocaleTranslator::between('fa', 'en')->translate('منفی پانصد'); // negative five hundred
echo Numera::init('en')->setCamelCase(true)->n2w(-10); // Negative Ten
$result = $numera->w2n('four billion, four hundred fifty-four million, five hundred forty-five thousand, one hundred fifty-six', [' ', ',']);
echo $result; // Output: 4454545156
$numera->setCamelCase(true);
$result = $numera->convertToWords('4,454,545,156');
echo $result; // Output: "Four Billion, Four Hundred Fifty-Four Million, Five Hundred Forty-Five Thousand, One Hundred Fifty-Six"
Numera::detectFormat("1.234.567,89"); // european
echo Numera::init('en')->n2w('۱۲۳۴');
echo Numera::init('en')->n2w("1'234'567.89");
echo Numera::init('en')->n2w('1_000_000');
echo Numera::init('en')->toFraction(0.5); // one half
echo Numera::init('en')->n2f(1.5); // one and a half
echo Numera::init('fa')->toFraction(0.5); // نیم
echo Numera::init('en')->toYear(2024); // twenty twenty-four
echo Numera::init('en')->n2y(2000); // two thousand
echo Numera::init('fa')->toYear(1402); // cardinal Persian form
Numera::init('en-US')->n2w(42); // same words as en, US meta
Numera::init('en-GB')->toCurrency(3.01, 'GBP');
Numera::init('fa-IR')->getWeekdays(); // inherits fa (week starts Saturday)
Numera::init('de-AT')->getStrategyName(); // german (inherited from de)
$numera->setLocale('fa'); // Set locale to Persian
$numera->setLocaleFallback('en'); // Set fallback locale to English
$translates = $numera->getTranslates();
print_r($translates); // Output: Array of translates for the current locale
$numera->addTranslate('fr', ['four' => 'quatre']); // Add French translates
$numera->addTranslateFile('fr','/path/lang/fr.php'); // Add French translates