Download the PHP package hikuroshi/terbilang-number-to-word without Composer
On this page you can find all versions of the php package hikuroshi/terbilang-number-to-word. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download hikuroshi/terbilang-number-to-word
More information about hikuroshi/terbilang-number-to-word
Files in hikuroshi/terbilang-number-to-word
Package terbilang-number-to-word
Short Description A PHP library for converting numbers into words in any language.
License MIT
Informations about the package 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
You can install this package via Composer:
Usage
Methods
Terbilang::terbilang(int $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 isfalse
.
...
Terbilang::simply($simply = 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 isfalse
.
...
Terbilang::separator(string $separator): Terbilang
Set the separator to use between words.
$separator
: The separator string. Default is" "
.
...
Terbilang::caseStyle(string $caseStyle): Terbilang
Set the case style for the output string.
$caseStyle
: The case style 'camel', 'snake', 'kebab', 'pascal', 'macro', or 'train'. Default is 'lowercase'.
...
Terbilang::lang(string $language): Terbilang
Set the language for number conversion.
$language
: The language code (e.g., 'id' for Indonesian, 'en' for English). Default isen
.
Supported Languages
Language | Code | Simply Rules |
---|---|---|
English | 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
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.
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,
Supported Numbering Systems
Numbering System | Code |
---|---|
Standart | default |
Japanese | japanese |
...
Contributing
Thank you for considering contributing to this project!
License
This project is licensed under the MIT License - see the LICENSE file for details.
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.
Thank you for your support!