PHPackages                             riskihajar/terbilang - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. riskihajar/terbilang

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

riskihajar/terbilang
====================

Number to words conversion support multi language.

2.1.1(4mo ago)135178.6k↓34%44[1 issues](https://github.com/riskihajar/terbilang/issues)[2 PRs](https://github.com/riskihajar/terbilang/pulls)MITPHPPHP ^8.1CI passing

Since Apr 1Pushed 2mo ago5 watchersCompare

[ Source](https://github.com/riskihajar/terbilang)[ Packagist](https://packagist.org/packages/riskihajar/terbilang)[ Docs](https://github.com/riskihajar/terbilang)[ RSS](/packages/riskihajar-terbilang/feed)WikiDiscussions 2.x Synced 2d ago

READMEChangelog (6)Dependencies (11)Versions (34)Used By (0)

Number To Words Conversion For Laravel
======================================

[](#number-to-words-conversion-for-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/f8b543cf296165092434cea38178dc33519c2a3d0f5d3c1d23ea21035cbc3a88/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7269736b6968616a61722f74657262696c616e672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/riskihajar/terbilang)[![GitHub Tests Action Status](https://camo.githubusercontent.com/42ab92325508356277306cb3af576b1a10a1ffd25328d1a60476a29185af89ad/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7269736b6968616a61722f74657262696c616e672f72756e2d74657374732e796d6c3f6272616e63683d322e78266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/riskihajar/terbilang/actions?query=workflow%3Arun-tests+branch%3A2.x)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/37569088a8ea74b843b35eef978988cec0eabdba605aa96c5159e93b39e6cd5f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7269736b6968616a61722f74657262696c616e672f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d322e78266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/riskihajar/terbilang/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3A2.x)[![Total Downloads](https://camo.githubusercontent.com/71b7b78a230fddc2c8342cebea1547f4d0ca116032938d5dce8f9961aba8a9eb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7269736b6968616a61722f74657262696c616e672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/riskihajar/terbilang)

Number to words conversion support multi language.

Warning

Before you install this package, please check [Laravel Numbers Helper](https://laravel.com/docs/11.x/helpers#numbers-method-list), since laravel officially support numbers helper, maybe this package will deprecated soon.

### Supported Language

[](#supported-language)

- `id` | Bahasa Indonesia
- `en` | English
- `pt` | Portuguese
- soon

### Feature

[](#feature)

- [Number to Words](https://github.com/riskihajar/terbilang#number-to-words)
- [Number to Roman](https://github.com/riskihajar/terbilang#number-to-roman)
- [Number Large Conversion](https://github.com/riskihajar/terbilang#number-large-conversion) (Number Short Hand in past version)
- [Datetime to Words](https://github.com/riskihajar/terbilang#datetime)
- [Distance Date](https://github.com/riskihajar/terbilang#distance-date) (Period in past version)

Version Compatibility
---------------------

[](#version-compatibility)

LaravelTerbilangPHP4.x1.0.45.x - 7.x1.2.x8.x - 9.x2.0.x^7.4 | ^8.010.x - 13.x2.1.x^8.1Installation
------------

[](#installation)

You can install the package via composer:

```
composer require riskihajar/terbilang:^2.1
```

Usage
-----

[](#usage)

#### Service Provider &amp; Facade

[](#service-provider--facade)

This package supports **Laravel auto-discovery**, so the service provider and facade are registered automatically. No manual setup needed.

If you prefer to register manually (e.g. in `config/app.php`):

```
// In the $providers array
Riskihajar\Terbilang\TerbilangServiceProvider::class,

// In the $aliases array
'Terbilang' => Riskihajar\Terbilang\Facades\Terbilang::class,
```

#### Publish Configuration (Optional)

[](#publish-configuration-optional)

If you want customize configuration, you can run following command to publish config file

```
php artisan vendor:publish --provider="Riskihajar\Terbilang\TerbilangServiceProvider"

```

This is the contents of the published config file:

```
return [
    'output' => [
        'date' => '{DAY} {MONTH} {YEAR}',
        'time' => '{HOUR} {SEPARATOR} {MINUTE} {MINUTE_LABEL} {SECOND} {SECOND_LABEL}',
    ],

    'locale' => 'en',

    'distance' => [
        'type' => \Riskihajar\Terbilang\Enums\DistanceDate::Day,
        'template' => '{YEAR} {MONTH} {DAY} {HOUR} {MINUTE} {SECOND}',
        'hide_zero_value' => true,
        'separator' => ' ',
        'terbilang' => false,
        'show' => [
            'year' => true,
            'month' => true,
            'day' => true,
            'hour' => true,
            'minute' => true,
            'second' => true,
        ],
    ],
];
```

### Examples

[](#examples)

#### Number To Words

[](#number-to-words)

`Terbilang::make($number, $suffix, $prefix)`

if you set locale to en

```
Config::set('terbilang.locale', 'en');

Terbilang::make(1000000); // one million
```

if you set locale to id

```
Config::set('terbilang.locale', 'id');

Terbilang::make(1000000); // satu juta
```

##### Prefix &amp; Suffix

[](#prefix--suffix)

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
```

#### Number to Roman

[](#number-to-roman)

`Terbilang::roman($number, $lowercase=false)`

```
Terbilang::roman(1234); // MCCXXXIV
```

#### Number Large Conversion

[](#number-large-conversion)

`Terbilang::short($number, $format)`

Available short hand : `kilo, million, billion, trillion`

Default value : `million`

if you set locale to en

```
Terbilang::short(1000000); // 1M
```

if you set locale to id

```
Terbilang::short(1000000); // 1jt
```

#### Datetime

[](#datetime)

##### Date `Terbilang::date($date, $format='Y-m-d');`

[](#date-terbilangdatedate-formaty-m-d)

```
$date = date('Y-m-d'); // 2015-03-31
Terbilang::date($date);
// Result : tiga puluh satu maret dua ribu lima belas
```

##### Time `Terbilang::time($date, $format='h:i:s');`

[](#time-terbilangtimedate-formathis)

```
$date = date('h:i:s'); //10:56:30
Terbilang::time($date);
// Result : sepuluh lewat lima puluh enam menit tiga puluh tiga detik
```

##### Date Time `Terbilang::datetime($date, $format='Y-m-d h:i:s');`

[](#date-time-terbilangdatetimedate-formaty-m-d-his)

```
$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
```

##### Using Carbon

[](#using-carbon)

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);
```

#### Distance Date

[](#distance-date)

You can diff two dates or just one date and automaticly with current date use method `Terbilang::distance($start, $end=null, $format=null)`

##### Config for distance format

[](#config-for-distance-format)

```
'distance' => [
     'type' => 'FULL',
     'format' => '{YEAR} {MONTH} {DAY} {HOUR} {MINUTE} {SECOND}',
     'hide_zero_value' => true,
     'separator' => ' ',
     'terbilang' => false,
     'show' => [
         'year' => true,
         'month' => true,
         'day' => true,
         'hour' => true,
         'minute' => true,
         'second' => true,
     ]
 ],
```

##### Example Distance

[](#example-distance)

```
$date1 = date('Y-m-d', strtotime('2017-05-01')); // dateformat must Y-m-d H:i:s
$date2 = date('Y-m-d', strtotime('2017-06-15 09:30:15'));

// this method will diff $date1 with current datetime value for example current datetime : 2017-09-08 15:17:54
Terbilang::period($date1); // Result : 4 months 8 days 15 hours 17 minutes 54 seconds

Terbilang::period($date1, $date2); // Result : 1 months 15 days 9 hours 30 minutes 15 seconds

// if you set locale to id
Terbilang::period($date1, $date2); // Result : 1 bulan 15 hari 9 jam 30 menit 15 detik

// if you set config period.terbilang to true
Terbilang::period($date1, $date2); // Result : satu bulan lima belas hari sembilan jam tiga puluh menit lima belas detik

// if you set config period.type to DAY
Terbilang::period($date1, $date2); // Result : 45 hari
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Rizky Hajar](https://github.com/riskihajar)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

63

—

FairBetter than 99% of packages

Maintenance81

Actively maintained with recent releases

Popularity51

Moderate usage in the ecosystem

Community19

Small or concentrated contributor base

Maturity83

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 76.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~137 days

Recently: every ~76 days

Total

30

Last Release

132d ago

Major Versions

1.2.5 → 2.0.02023-02-18

1.x-dev → 2.0.42023-10-06

PHP version history (4 changes)1.0.1PHP &gt;=5.4.0

2.0.0PHP ^8.1

2.0.1PHP ^7.4|^8.0|^8.1

2.0.8PHP ^7.4|^8.0|^8.1|^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/09fb9e9c9872bcd25cb725299937f7a3f51bc29bb7b6ec372985409a9c7f893d?d=identicon)[riskihajar](/maintainers/riskihajar)

---

Top Contributors

[![riskihajar](https://avatars.githubusercontent.com/u/6370157?v=4)](https://github.com/riskihajar "riskihajar (124 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (21 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (15 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (2 commits)")

---

Tags

conversiondatetimelaravelperiodphpterbilanglaravelterbilangnumber to wordsdate to wordsnumber to romanriskihajar

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/riskihajar-terbilang/health.svg)

```
[![Health](https://phpackages.com/badges/riskihajar-terbilang/health.svg)](https://phpackages.com/packages/riskihajar-terbilang)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M345](/packages/psalm-plugin-laravel)[codewithdennis/filament-select-tree

The multi-level select field enables you to make single selections from a predefined list of options that are organized into multiple levels or depths.

329530.5k29](/packages/codewithdennis-filament-select-tree)[worksome/exchange

Check Exchange Rates for any currency in Laravel.

124603.0k](/packages/worksome-exchange)[tomshaw/electricgrid

A feature-rich Livewire package designed for projects that require dynamic, interactive data tables.

119.4k](/packages/tomshaw-electricgrid)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
