PHPackages                             ngekoding/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. ngekoding/terbilang

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

ngekoding/terbilang
===================

A library to convert numbers and currency to words in Indonesian.

v1.0.2(1y ago)9803↓50%1MITPHPPHP &gt;=5.6

Since Jun 13Pushed 1y ago2 watchersCompare

[ Source](https://github.com/ngekoding/php-terbilang)[ Packagist](https://packagist.org/packages/ngekoding/terbilang)[ RSS](/packages/ngekoding-terbilang/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (1)Versions (4)Used By (0)

PHP Terbilang
=============

[](#php-terbilang)

PHP Terbilang is a library that converts number or currency amount into their Indonesian words representation.

Features
--------

[](#features)

- Converts number values to words in Indonesian.
- Converts currency amounts (in rupiah) to words.
- Supported decimals (comma) for both regular number and currency.

Installation
------------

[](#installation)

You can install via composer:

```
composer require ngekoding/terbilang
```

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

This is how to convert a regular number to words:

```
use Ngekoding\Terbilang\Terbilang;

echo Terbilang::convert(12345); // Outputs: "dua belas ribu tiga ratus empat puluh lima"
echo Terbilang::convert(12345.67); // Outputs: "dua belas ribu tiga ratus empat puluh lima koma enam tujuh"
```

Then pass the second paramater to `true` for currency amount:

```
echo Terbilang::convert(12345, true); // Outputs: "dua belas ribu tiga ratus empat puluh lima rupiah"
echo Terbilang::convert(12345.67, true); // Outputs: "dua belas ribu tiga ratus empat puluh lima rupiah enam puluh tujuh sen"
```

### Options

[](#options)

You can customize the decimal separator for your conversions:

```
// Convert with a custom decimal separator (e.g., ',')
echo Terbilang::convert('12345,67', true, ','); // Outputs: "dua belas ribu tiga ratus empat puluh lima rupiah enam puluh tujuh sen"

// Or you can change it globally
Terbilang::setDecimalSeparator(',');

echo Terbilang::convert('12345,67'); // Outputs: "dua belas ribu tiga ratus empat puluh lima koma enam tujuh"
echo Terbilang::convert('12345,25', true); // Outputs: "dua belas ribu tiga ratus empat puluh lima rupiah dua puluh lima sen"
```

**Note:** Will affected only for string input.

### Advanced Usage

[](#advanced-usage)

You can use either numeric or string inputs, but there are some important considerations when dealing with decimals.

For **regular numbers**, when using numeric input, trailing zeros after the decimal point are not preserved. For example, the number `12345.500` will be presented as `12345.5`.

Especially for **currency amounts**, two decimal places are always used to adhere to rupiah standards.

To handle the entire input number, including trailing zeros after the decimal point, use string input.

```
echo Terbilang::convert(12345.50); // Outputs: "dua belas ribu tiga ratus empat puluh lima koma lima"
echo Terbilang::convert('12345.50'); // Outputs: "dua belas ribu tiga ratus empat puluh lima koma lima nol"
echo Terbilang::convert('12345.500'); // Outputs: "dua belas ribu tiga ratus empat puluh lima koma lima nol nol"

echo Terbilang::convert(12345.5, true); // Outputs: "dua belas ribu tiga ratus empat puluh lima rupiah lima puluh sen"
echo Terbilang::convert(12345.50, true); // Outputs: "dua belas ribu tiga ratus empat puluh lima rupiah lima puluh sen"
echo Terbilang::convert(12345.505, true); // Outputs: "dua belas ribu tiga ratus empat puluh lima rupiah lima puluh satu sen"
echo Terbilang::convert('12345.500', true); // Outputs: "dua belas ribu tiga ratus empat puluh lima rupiah lima ratus sen"
```

Additionally, with string input, you can easily pass already formatted numbers.

```
echo Terbilang::convert('Rp1.500.100,50', true, ','); // Outputs: "satu juta lima ratus ribu seratus rupiah lima puluh sen"
```

For currency amounts with `,00` decimals, the decimal part will be ignored, as this is the correct format for writing rupiah.

```
echo Terbilang::convert('Rp1.500.100,00', true, ','); // Outputs: "satu juta lima ratus ribu seratus rupiah"
```

API
---

[](#api)

```
Terbilang::convert($number, $isCurrency = false, $decimalSeparator = null)
```

Converts a number or currency amount into its Indonesian words representation.

- **$number** (mixed): The number or currency amount to convert.
- **$isCurrency** (bool, optional): Whether the conversion is for currency (default: false).
- **$decimalSeparator** (string, optional): The decimal separator used in the number (default: '.').

References
----------

[](#references)

This library aims to adhere to Indonesian language standards.

- [Pedoman Umum Ejaan Bahasa Indonesia (PUEBI)](https://badanbahasa.kemdikbud.go.id/lamanbahasa/sites/default/files/PUEBI.pdf)
- [Kamus Besar Bahasa Indonesia (KBBI) Kemdikbud](https://kbbi.kemdikbud.go.id)

Testing
-------

[](#testing)

```
composer test
```

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

[](#contributing)

Feel free to contribute to improve this library. Fork it, make changes, and submit a pull request.

License
-------

[](#license)

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

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance32

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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 ~3 days

Total

3

Last Release

697d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/badefbaef2fd421d3b05261b2eb984562dee50392d83632bdb6549aff655e25e?d=identicon)[ngekoding](/maintainers/ngekoding)

---

Top Contributors

[![ngekoding](https://avatars.githubusercontent.com/u/11625690?v=4)](https://github.com/ngekoding "ngekoding (4 commits)")

---

Tags

currency-to-wordsnumbers-to-wordsphp-terbilangterbilangmoneycurrencywordsnumberstoterbilang

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[kwn/number-to-words

Multi language standalone PHP number to words converter. Fully tested, open for extensions and new languages.

4235.0M21](/packages/kwn-number-to-words)[brick/money

Money and currency library

1.9k37.9M102](/packages/brick-money)[florianv/swap

Exchange rates library for PHP

1.3k6.4M16](/packages/florianv-swap)[cknow/laravel-money

Laravel Money

1.0k4.3M22](/packages/cknow-laravel-money)[akaunting/laravel-money

Currency formatting and conversion package for Laravel

7825.3M18](/packages/akaunting-laravel-money)[florianv/laravel-swap

Currency exchange rates library for Laravel and Lumen

3342.0M2](/packages/florianv-laravel-swap)

PHPackages © 2026

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