PHPackages                             pinoox/numera - 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. pinoox/numera

ActiveLibrary

pinoox/numera
=============

Translate Numera

1.1.2(2y ago)1816.0k—3.8%3[1 issues](https://github.com/pinoox/numera/issues)MITPHPPHP ^8.0

Since Apr 28Pushed 1y agoCompare

[ Source](https://github.com/pinoox/numera)[ Packagist](https://packagist.org/packages/pinoox/numera)[ Docs](http://www.pinoox.com/)[ RSS](/packages/pinoox-numera/feed)WikiDiscussions master Synced 1mo ago

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

**Numera: A PHP Library for Number to Words Conversion**
========================================================

[](#numera-a-php-library-for-number-to-words-conversion)

[![Latest Stable Version](https://camo.githubusercontent.com/d1392fbe7d4eb49581cb2e47fa0c4133371c6f416e7cbc0f00e8019fa7a03d08/68747470733a2f2f706f7365722e707567782e6f72672f70696e6f6f782f6e756d6572612f762f737461626c65)](https://packagist.org/packages/pinoox/numera)[![GitHub Stars](https://camo.githubusercontent.com/b8f038a6126ad78179bdcf3414f74e17c33c884eabc505b9caed48c09e5dad5b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f70696e6f6f782f6e756d6572612e737667)](https://github.com/pinoox/numera/stargazers)[![GitHub Forks](https://camo.githubusercontent.com/1ec7747f044771630c361143ff5093d935d6946a276628ed156c6d375a00e5dc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f70696e6f6f782f6e756d6572612e737667)](https://github.com/pinoox/numera/network)[![GitHub Issues](https://camo.githubusercontent.com/5da659c58a8802327da251eb28eb9ffde686abbad543078ddc6d2d0a0c0c96a5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f70696e6f6f782f6e756d6572612e737667)](https://github.com/pinoox/numera/issues)[![License](https://camo.githubusercontent.com/d90f3bf397a9b24fd50d0680343ad7092d3d3a7115b19af7f5a6f2a7acdcf47e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f70696e6f6f782f6e756d6572612e737667)](https://github.com/pinoox/numera/blob/master/LICENSE)[![Total Downloads](https://camo.githubusercontent.com/24159a120beb6efc1cf3e06044570d889533322a2b91b170e54d12ac9b05fc33/68747470733a2f2f706f7365722e707567782e6f72672f70696e6f6f782f6e756d6572612f646f776e6c6f616473)](https://packagist.org/packages/pinoox/numera)

Numera is a PHP library that provides a simple and efficient way to convert numbers to words and vice versa. It supports multiple languages and can be easily extended to support more languages.

- [Features](#features)
- [Installation and Setup](#installation-and-setup)
    - [Install via Composer](#install-via-composer)
    - [Initialize Numera](#initialize-numera)
- [Usage](#usage)
    - [Convert Numbers to Words](#convert-numbers-to-words)
    - [Convert Numbers to Summary Words](#convert-numbers-to-summary)
    - [Convert Words to Numbers](#convert-words-to-numbers)
    - [Use Camel Case](#use-camel-case)
- [Supported Languages](#supported-languages)
- [Set Locale](#set-locale)
- [Set Locale Fallback](#set-locale-fallback)
- [Get Translates](#get-translates)
- [Add Translate](#add-translate)
- [Create a New Language](#create-a-new-language)
- [Author](#author)
- [Contributing](#contributing)
- [Documentation](#documentation)
- [License](#license)

**Features**
------------

[](#features)

- Convert numbers to words (e.g. 1234 to "one thousand two hundred thirty-four")
- Convert words to numbers (e.g. "one thousand two hundred thirty-four" to 1234)
- Support for multiple languages (currently English and Persian, with more to come)
- Camel case support for output words
- Easy to use and extend

**Installation and Setup**
--------------------------

[](#installation-and-setup)

### Install via Composer

[](#install-via-composer)

You can install Numera using Composer:

```
composer require pinoox/numera

```

### Initialize Numera

[](#initialize-numera)

To use Numera, you need to initialize it with a locale. You can do this using the `init` method:

```
use Pino\Numera;

$numera = Numera::init('en'); // Initialize with English locale
```

### Convert Numbers to Words

[](#convert-numbers-to-words)

To convert a number to words, use the `convertToWords` method:

```
$result = $numera->convertToWords(4454545156);
echo $result; // Output: "four billion, four hundred fifty-four million, five hundred forty-five thousand, one hundred fifty-six"
```

Alternatively, you can use the `n2w` method for a simpler syntax:

```
$result = $numera->n2w('4,454,545,156');
echo $result; // Output: "four billion, four hundred fifty-four million, five hundred forty-five thousand, one hundred fifty-six"
```

### Convert Numbers to Summary

[](#convert-numbers-to-summary)

To convert a number to summary words, use the `convertToSummary` method:

```
$result = $numera->convertToSummary(4454545156);
echo $result; // Output: "4 Billion, 454 Million, 545 Thousand, 156"
```

Alternatively, you can use the `n2w` method for a simpler syntax:

```
$result = $numera->n2s('4,454,545,156');
echo $result; // Output: "4 Billion, 454 Million, 545 Thousand, 156"
```

### Convert Words to Numbers

[](#convert-words-to-numbers)

To convert words to a number, use the `convertToNumber` method:

```
$result = $numera->convertToNumber('four billion, four hundred fifty-four million, five hundred forty-five thousand, one hundred fifty-six');
echo $result; // Output: 4454545156
```

Alternatively, you can use the `w2n` method for a simpler syntax:

```
$result = $numera->w2n("4 Billion, 454 Million, 545 Thousand, 156");
echo $result; // Output: 4454545156
```

You can also specify separators for the `w2n` method:

```
$result = $numera->w2n('four billion, four hundred fifty-four million, five hundred forty-five thousand, one hundred fifty-six', [' ', ',']);
echo $result; // Output: 4454545156
```

### Use Camel Case

[](#use-camel-case)

To use camel case for output words, use the `setCamelCase` method:

```
$numera->setCamelCase(true);
$result = $numera->convertToWords('4,454,545,156');
echo $result; // Output: "Four Billion, Four Hundred Fifty-Four Million, Five Hundred Forty-Five Thousand, One Hundred Fifty-Six"
```

### Supported Languages

[](#supported-languages)

Numera currently supports the following languages:

- English (en)
- Persian (fa)

### Set Locale

[](#set-locale)

To set the locale for the Numera object, use the `setLocale` method:

```
$numera->setLocale('fa'); // Set locale to Persian
```

### Set Locale Fallback

[](#set-locale-fallback)

To set the fallback locale for the Numera object, use the `setLocaleFallback` method:

```
$numera->setLocaleFallback('en'); // Set fallback locale to English
```

### Get Translates

[](#get-translates)

To get the translates for the current locale, use the `getTranslates` method:

```
$translates = $numera->getTranslates();
print_r($translates); // Output: Array of translates for the current locale
```

### Add Translate

[](#add-translate)

To add translates for a specific locale, use the `addTranslate` method:

```
$numera->addTranslate('fr', ['four' => 'quatre']); // Add French translates
```

### Add Translate File

[](#add-translate-file)

To add translates by array file for a specific locale, use the `addTranslateFile` method:

```
$numera->addTranslateFile('fr','/path/lang/fr.php'); // Add French translates
```

### Create a New Language

[](#create-a-new-language)

If you want to add support for a new language, please read our [Translation Guide](TranslationGuide.md) for a step-by-step guide on how to create a new language pack.

**Author**
----------

[](#author)

Numera was created by [Pinoox](https://www.pinoox.com/).

**Contributing**
----------------

[](#contributing)

If you'd like to contribute to Numera, please fork the repository and submit a pull request. We'd love to have your help.

**Documentation**
-----------------

[](#documentation)

- [README.md](README.md) - Documents
- [TranslationGuide.md](TranslationGuide.md) - Guide for creating a new language pack

**License**
-----------

[](#license)

Numera is licensed under the [MIT License](https://opensource.org/licenses/MIT). See the LICENSE file for more information.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance30

Infrequent updates — may be unmaintained

Popularity35

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity48

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

Total

3

Last Release

747d ago

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

phpnumber translate

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/pinoox-numera/health.svg)

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

###  Alternatives

[pestphp/pest-plugin-stressless

Stressless plugin for Pest

67792.6k16](/packages/pestphp-pest-plugin-stressless)

PHPackages © 2026

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