PHPackages                             hikuroshi/terbilang-number-to-word - 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. hikuroshi/terbilang-number-to-word

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

hikuroshi/terbilang-number-to-word
==================================

A PHP library for converting numbers into words in any language.

1.2.0(1y ago)227MITPHPPHP ^7.4 || ^8.0

Since Jun 8Pushed 1y ago1 watchersCompare

[ Source](https://github.com/Hikuroshi/terbilang-number-to-word)[ Packagist](https://packagist.org/packages/hikuroshi/terbilang-number-to-word)[ RSS](/packages/hikuroshi-terbilang-number-to-word/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (4)Used By (0)

Terbilang Number To Word
========================

[](#terbilang-number-to-word)

Terbilang is a PHP library for converting numbers into words in any language. It provides a simple and flexible way to convert numeric values into their word representations.

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

[](#installation)

You can install this package via Composer:

```
composer require hikuroshi/terbilang-number-to-word
```

Usage
-----

[](#usage)

```
use Hikuroshi\Terbilang\Terbilang;

// Convert number to words
echo Terbilang::terbilang(24434);
// Outputs "twenty four thousand four hundred thirty four"

// Convert number to words with digit separation
echo Terbilang::terbilang(24434, true);
// Outputs "two four four three four"
```

Methods
-------

[](#methods)

### `Terbilang::terbilang(int $number, bool $apart = false): Terbilang`

[](#terbilangterbilangint-number-bool-apart--false-terbilang)

Create a new instance of the Terbilang class with the specified number.

- `$number`: The number to be converted to words.
- `$apart`: Whether to use separated word representation for each digit (true) or full number word representation (false). Default is `false`.

```
use Hikuroshi\Terbilang\Terbilang;

// Convert number to words
echo Terbilang::terbilang(24434);
// Outputs "twenty four thousand four hundred thirty four"
```

...

### `Terbilang::simply($simply = true | array): Terbilang`

[](#terbilangsimplysimply--true--array-terbilang)

Simplify the word representation based on the specified rules. Examples such as "One Hundred" to "A Hundred"

- `$simply`: If true, apply default simplification rules. If array, use the specified simplification rules. Default without use this method is `false`.

```
use Hikuroshi\Terbilang\Terbilang;

// Convert number with default simplification
echo Terbilang::terbilang(1111)->simply();
// Outputs "a thousand a hundred eleven"

// Convert number with specified simplification
echo Terbilang::terbilang(1111)->simply(['hundred']);
// Outputs "one thousand a hundred eleven"
```

...

### `Terbilang::separator(string $separator): Terbilang`

[](#terbilangseparatorstring-separator-terbilang)

Set the separator to use between words.

- `$separator`: The separator string. Default is `" "`.

```
use Hikuroshi\Terbilang\Terbilang;

// Convert number with custom separator
echo Terbilang::terbilang(24434)->separator(' >//< ');
// Outputs "twenty >//< four >//< thousand >//< four >//< hundred >//< thirty >//< four"
```

...

### `Terbilang::caseStyle(string $caseStyle): Terbilang`

[](#terbilangcasestylestring-casestyle-terbilang)

Set the case style for the output string.

- `$caseStyle`: The case style 'camel', 'snake', 'kebab', 'pascal', 'macro', or 'train'. Default is 'lowercase'.

```
use Hikuroshi\Terbilang\Terbilang;

// Convert number with camel case style
echo Terbilang::terbilang(24434)->caseStyle('camel');
// Outputs "twentyFourThousandFourHundredThirtyFour"
```

...

### `Terbilang::lang(string $language): Terbilang`

[](#terbilanglangstring-language-terbilang)

Set the language for number conversion.

- `$language`: The language code (e.g., 'id' for Indonesian, 'en' for English). Default is `en`.

```
use Hikuroshi\Terbilang\Terbilang;

// Convert number to words with Indonesian language
echo Terbilang::terbilang(24434)->lang('id');
// Outputs "dua puluh empat ribu empat ratus tiga puluh empat"
```

#### Supported Languages

[](#supported-languages)

LanguageCodeSimply RulesEnglish`en``["hundred", "thousand", "million", "billion", "trillion", "quadrillion", "quintillion"]`Indonesian`id``["ratus", "ribu", "juta", "milyar", "triliun", "kuardriliun", "kuintiliun"]`Japanese`jp`-...

### `Terbilang::loadLang(array|string $languageData): Terbilang`

[](#terbilangloadlangarraystring-languagedata-terbilang)

Load custom language rules for number conversion. This method allows loading custom language rules either from an array or a JSON file. The custom language rules will merge with the default language rules.

- `$languageData`: The custom language data. It can be an associative array of language rules, or a path to a JSON file containing the language rules.

```
use Hikuroshi\Terbilang\Terbilang;

// Load custom language rules from an array
$customLanguageRules = [
    "units" => ["rei", "ichi", "ni", "san", "yon", "go", "roku", "nana", "hachi", "kyuu"]
];

echo Terbilang::loadLang($customLanguageRules)->terbilang(24434);
// Outputs "twenty yon thousand yon hundred thirty yon"

// Load custom language rules from a JSON file
echo Terbilang::loadLang('/path/to/custom_language_rules.json')->terbilang(24434);
```

If your custom language rules is use different numbering system like japanese, please add "numberingSystem" to the array to specify the numbering system. For example,

```
$customLanguageRules = [
    "units" => ["rei", "ichi", "ni", "san", "yon", "go", "roku", "nana", "hachi", "kyuu"],
    "numberingSystem" => "japanese"
];
```

#### Supported Numbering Systems

[](#supported-numbering-systems)

Numbering SystemCodeStandart`default`Japanese`japanese`...

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

[](#contributing)

Thank you for considering contributing to this project!

License
-------

[](#license)

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

Support the Project
-------------------

[](#support-the-project)

If you find this project useful and would like to support its development, please consider making a donation. Your contributions help to cover the costs of development and ensure the project remains well-maintained.

[![ko-fi](https://camo.githubusercontent.com/201ef269611db7eb6b5d08e9f756ab8980df3014b64492770bdf13a6ed924641/68747470733a2f2f6b6f2d66692e636f6d2f696d672f676974687562627574746f6e5f736d2e737667)](https://ko-fi.com/hikuroshi)

Thank you for your support!

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance32

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 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 ~6 days

Total

3

Last Release

692d ago

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

numbernumber-converternumber-to-wordsnumbertotextnumbertowordsphpterbilang

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/hikuroshi-terbilang-number-to-word/health.svg)

```
[![Health](https://phpackages.com/badges/hikuroshi-terbilang-number-to-word/health.svg)](https://phpackages.com/packages/hikuroshi-terbilang-number-to-word)
```

###  Alternatives

[slm/google-analytics

Google Analytics tracking integration for Zend Framework 2

4180.3k](/packages/slm-google-analytics)[craftcms/rector

Rector sets to automate Craft CMS upgrades

17232.9k257](/packages/craftcms-rector)[aiz-packages/combination-generate

Generate combinations of items in multiple arrays

1218.0k](/packages/aiz-packages-combination-generate)

PHPackages © 2026

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