PHPackages                             ivanovsaleksejs/num-to-text - 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. ivanovsaleksejs/num-to-text

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

ivanovsaleksejs/num-to-text
===========================

Converts numbers or prices to text representation in various languages. For example, 437605 becomes "four hundred thirty seven thousand six hundred five". Price class for displaying prices with currencies is also available.

2015.9k↓27.5%9PHPCI failing

Since Apr 18Pushed 2y ago2 watchersCompare

[ Source](https://github.com/ivanovsaleksejs/NumToText)[ Packagist](https://packagist.org/packages/ivanovsaleksejs/num-to-text)[ RSS](/packages/ivanovsaleksejs-num-to-text/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

NumToText
=========

[](#numtotext)

Converts numbers or prices to text representation in various languages.

### Supported languages

[](#supported-languages)

Currently, library supports these languages:

- English
- Russian
- Latvian

French and Spanish are in progress.

### How to install

[](#how-to-install)

```
composer require ivanovsaleksejs/num-to-text:dev-master
```

or add to your composer.json

```
{
    "require": {
        "ivanovsaleksejs\num-to-text": "^2.*"
    }
}
```

and then

```
composer install
```

### How to use

[](#how-to-use)

```
include __DIR__ . '/vendor/autoload.php';

use ivanovsaleksejs\NumToText\Num;
use ivanovsaleksejs\NumToText\Price;

echo Num::toText(1234, 'EN') . "\n";
// Echoes 'one thousand two hundred thirty four'

echo Price::toText(123456.78, [['dollars', 'dollar'], ['cents', 'cent']], 'EN', true) . "\n";
// Echoes 'one hundred twenty three thousand four hundred fifty six dollars 78 cents'

echo Price::toText(123456.78, [['dollars', 'dollar'], ['cents', 'cent']], 'EN') . "\n";
// Echoes 'one hundred twenty three thousand four hundred fifty six dollars seventy eight cents'

echo Price::toText(1.02, [['рублей', 'рубль', 'рубля'], ['копеек', 'копейка', 'копейки']], 'RU', false, false, [0, 1]); . "\n";
// Echoes 'один рубль две копейки'
// Please note, the sixth parameter specifies the gender for the integer and decimal parts of the number respectively
// 0 - masculine
// 1 - feminine
// 2 - neutral
```

### How to add new language

[](#how-to-add-new-language)

To add a language, you need to:

- extend main class NumToText (to make sure shorthand functions work, add the code of the language in caps after underscore to the name of new class, for example, NumToText\_DE)
- define functions `digitToWord` and `toWords`
- override some other functions of main class if necessary.

### How to run unit tests

[](#how-to-run-unit-tests)

```
./vendor/bin/phpunit
```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity36

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity19

Early-stage or recently created project

 Bus Factor1

Top contributor holds 58.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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/8a5e41cb1af1ee4a05b3a633c8442007dbf1186ddef7d07d45dcb569c51f7bf1?d=identicon)[Aleksejs](/maintainers/Aleksejs)

---

Top Contributors

[![ivanovsaleksejs](https://avatars.githubusercontent.com/u/1484549?v=4)](https://github.com/ivanovsaleksejs "ivanovsaleksejs (31 commits)")[![kavacky](https://avatars.githubusercontent.com/u/956387?v=4)](https://github.com/kavacky "kavacky (11 commits)")[![mixisLv](https://avatars.githubusercontent.com/u/3735128?v=4)](https://github.com/mixisLv "mixisLv (6 commits)")[![denismosolov](https://avatars.githubusercontent.com/u/3057626?v=4)](https://github.com/denismosolov "denismosolov (5 commits)")

### Embed Badge

![Health badge](/badges/ivanovsaleksejs-num-to-text/health.svg)

```
[![Health](https://phpackages.com/badges/ivanovsaleksejs-num-to-text/health.svg)](https://phpackages.com/packages/ivanovsaleksejs-num-to-text)
```

PHPackages © 2026

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