Number to words conversion support multi language.
id
| Bahasa Indonesiaen
| Englishpt
| Portuguese- soon
composer require riskihajar/terbilang --dev
or add this to composer.json
"riskihajar/terbilang": "dev-master"
then run composer update
Laravel 4 : In the $providers
array add the service providers for this package.
'Riskihajar\Terbilang\TerbilangServiceProvider',
Laravel 5 : In the $providers
array add the service providers for this package.
'Riskihajar\Terbilang\TerbilangL5ServiceProvider',
Add the facade of this package to the $aliases
array.
'Terbilang' => 'Riskihajar\Terbilang\Facades\Terbilang',
Terbilang::make($number, $suffix, $prefix)
if you set locale to en
Terbilang::make(1000000); // one million
if you set locale to id
Terbilang::make(1000000); // satu juta
if you set locale to id
Terbilang::make(123456, ' rupiah', 'senilai ');
// senilai seratus dua puluh tiga ribu, empat ratus lima puluh enam rupiah
if you set locale to en
Terbilang::make(654321, ' dollars');
// six hundred and fifty-four thousand, three hundred and twenty-one dollars
Terbilang::roman($number, $lowercase=false)
Terbilang::roman(1234); //MCCXXXIV
$date = date('Y-m-d'); // 2015-03-31
Terbilang::date($date);
// Result : tiga puluh satu maret dua ribu lima belas
$date = date('h:i:s'); //10:56:30
Terbilang::time($date);
// Result : sepuluh lewat lima puluh enam menit tiga puluh tiga detik
$date = date('Y-m-d h:i:s'); // 2015-03-31 10:58:27
Terbilang::datetime($date);
// Result : tiga puluh satu maret dua ribu lima belas pukul sepuluh lewat lima puluh delapan menit dua puluh tujuh detik
if using carbon, you can ignore $format
$dt = Carbon\Carbon::now('Asia/Makassar');
$date = Terbilang::date($dt);
$time = Terbilang::time($dt);
$datetime = Terbilang::datetime($dt);