PHPackages                             lla/numbers\_words - 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. lla/numbers\_words

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

lla/numbers\_words
==================

PEAR::Numbers\_Words to PSR-0 compliance. See https://github.com/pear/Numbers\_Words

1.0.1(9y ago)028PHP-3.01PHPPHP &gt;=5.4.20

Since Jul 29Pushed 9y ago1 watchersCompare

[ Source](https://github.com/ncrypthic/Numbers_Words)[ Packagist](https://packagist.org/packages/lla/numbers_words)[ Docs](https://github.com/ncrypthic/Numbers_Words)[ RSS](/packages/lla-numbers-words/feed)WikiDiscussions master Synced 2mo ago

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

Introduction
============

[](#introduction)

This repository is a fork of PEAR::Numbers\_Words as composer package with PSR-0 compliance.

Credits to all previous authors.

```
With PEAR::Numbers_Words class you can change an integer number
to simple words. This can be usefull when you need to spell a currency
value e.g. on an invoice.

You can choose between several languages (language files are located
in src/Numbers/Words/Locale directory).

BTW: if you need to change number to currency, use money_format()
PHP function (available since 4.3 (not yet released)). But you must
know that locale LC_MONETARY rules are sometimes unclear.

```

Getting started
---------------

[](#getting-started)

First you need to install lla/numbers\_words PEAR package. You can do it (as root) with:

```
composer install ncrypthic/numbers
```

In your php script you need to `use Numbers\Words`header file:

```
use \LLA\Numbers\Words;
```

Then you can call `Numbers_Words::fromWords()` function with two arguments: integer number (can be a string with digits) and optional locale name (default is *en\_US*):

```
use \LLA\Numbers\Words;

$num   = 12340000000;
$words = Words::fromWords($num,"en_GB");
echo "Num $num in British English is '$words'\n";
```

For this would display:

```
Num 12340000000 in British English is 'twelve thousand million three hundred forty million'

```

There are avaibale the following modules (called by locale name, in alphabetical order):

az - Azerbaijani language. Author: Shahriyar Imanov

bg - Bulgarian language (in WIN-1251 charset). Author: Kouber Saparev

cs - Czech language. Author: Petr 'PePa' Pavel

de - German language. Author: Piotr Klaban

dk - Danish language. Author: Jesper Veggerby

en\_100 - Donald Knuth number naming system, in English language. Author: Piotr Klaban

en\_GB - British English notation of numbers, where one billion is 1000000 times one million. 1000 times million is just 'thousand million' here. I do not use a word billiard here, because English people do not use it often, and even could not know it. Author: Piotr Klaban

en\_US - American English notation of numbers, where one billion is 1000 times one million Author: Piotr Klaban

es - Spanish (Castellano) language. Author: Xavier Noguer

es\_AR - Argentinian Spanish language. Author: Martin Marrese

et - Estonian language. Author: Erkki Saarniit

fr - French language. Author: Kouber Saparev

fr\_BE - French (Belgium) language. Author: Kouber Saparev, Philippe Bajoit

he - Hebrew language. Author: Hadar Porat

hu\_HU - Hungarian language. Author: Nils Homp

id - Indonesia language. Authors: Ernas M. Jamil, Arif Rifai Dwiyanto

it\_IT - Italian language. Authors: Filippo Beltramini, Davide Caironi

lt - Lithuanian language. Author: Laurynas Butkus

nl - Dutch language. Author: WHAM van Dinter

pl - Polish language (in an internet standard charset ISO-8859-2) Author: Piotr Klaban

pt\_BR - Brazilian Portuguese language. Authors: Marcelo Subtil Marcal, Mario H.C.T., Igor Feghali

ro\_RO - Romanian language. Author: Bogdan Stancescu

ru - Russian language. Author: Andrey Demenev

sv - Swedish language. Author: Robin Ericsson

tr\_TR - Turkish language. Author: Shahriyar Imanov

\*\* What if numbers have fraction part?

You can split the number by the coma or dot. The example function was provided by Ernas M. Jamil (see below). I do not know if the splitting and concatenating numbers should be supported by Numbers\_Words ... Does each language spell numbers with a 'coma'/'koma'? What do you think?

```
use \LLA\Numbers\Words;

function num2word($num, $fract = 0) {

    $num = sprintf("%.".$fract."f", $num);
    $fnum = explode('.', $num);

    $ret =  Words::fromNumber($fnum[0],"id");
    if(!$fract) return $ret;

    $ret .=  ' koma '; // point in english
    $ret .= Words::fromNumber($fnum[1],"id");

    return $ret;
}
```

\*\* How to convert decimal part and not fraction part of the currency value?

Rob King send me a patch that would allow to leave fraction part in digits. I.e. you can convert 31.01 into 'thirty-one pounds 01 pence':

```
use \LLA\Numbers\Words;
use \LLA\Numbers\Words\Locale\en\GB;

$obj = new GB();
$convert_fraction = false;
print $obj->toCurrencyWords('GBP', '31', '01', $convert_fraction) . "\n";
```

\*\* How to write new Language Files:

Just copy existing en\_US or en\_GB etc. file into src/LLA/Numbers/Words/Locale/{your\_country/locale code}.php and translate digits, numbers, tousands to your language. Then please send it to the author to the address .

\*\* Credits

All changes from other people are desrcribed with details in ChangeLog. There are also names of the people who send me patches etc. Authors of the language files are mentioned in the language files directly as the author.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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

Total

4

Last Release

3536d ago

Major Versions

v0.18.1 → 1.0.02016-08-30

PHP version history (2 changes)v0.18.0PHP &gt;=5.3.2

1.0.0PHP &gt;=5.4.20

### Community

Maintainers

![](https://www.gravatar.com/avatar/9c26f7887d1b0ea2e527417307094f7bb79eedfb013ca23da226c760b75c1aa5?d=identicon)[ncrypthic](/maintainers/ncrypthic)

---

Top Contributors

[![ifeghali](https://avatars.githubusercontent.com/u/70428?v=4)](https://github.com/ifeghali "ifeghali (52 commits)")[![CloCkWeRX](https://avatars.githubusercontent.com/u/365751?v=4)](https://github.com/CloCkWeRX "CloCkWeRX (52 commits)")[![kouber](https://avatars.githubusercontent.com/u/1536892?v=4)](https://github.com/kouber "kouber (26 commits)")[![cweiske](https://avatars.githubusercontent.com/u/59036?v=4)](https://github.com/cweiske "cweiske (19 commits)")[![ncrypthic](https://avatars.githubusercontent.com/u/564038?v=4)](https://github.com/ncrypthic "ncrypthic (11 commits)")[![ben-nsng](https://avatars.githubusercontent.com/u/5063993?v=4)](https://github.com/ben-nsng "ben-nsng (6 commits)")[![till](https://avatars.githubusercontent.com/u/27003?v=4)](https://github.com/till "till (4 commits)")[![itcreator](https://avatars.githubusercontent.com/u/928509?v=4)](https://github.com/itcreator "itcreator (4 commits)")[![shehi](https://avatars.githubusercontent.com/u/653569?v=4)](https://github.com/shehi "shehi (4 commits)")[![matvey-andreyev](https://avatars.githubusercontent.com/u/10144308?v=4)](https://github.com/matvey-andreyev "matvey-andreyev (3 commits)")[![Gutza](https://avatars.githubusercontent.com/u/574679?v=4)](https://github.com/Gutza "Gutza (3 commits)")[![jjk-jacky](https://avatars.githubusercontent.com/u/1540519?v=4)](https://github.com/jjk-jacky "jjk-jacky (1 commits)")[![danieldecsi](https://avatars.githubusercontent.com/u/4690386?v=4)](https://github.com/danieldecsi "danieldecsi (1 commits)")[![emilio-rst](https://avatars.githubusercontent.com/u/282907?v=4)](https://github.com/emilio-rst "emilio-rst (1 commits)")[![quipo](https://avatars.githubusercontent.com/u/321794?v=4)](https://github.com/quipo "quipo (1 commits)")[![Raaghu](https://avatars.githubusercontent.com/u/8255650?v=4)](https://github.com/Raaghu "Raaghu (1 commits)")[![gauthierm](https://avatars.githubusercontent.com/u/120511?v=4)](https://github.com/gauthierm "gauthierm (1 commits)")[![arch1t3ct](https://avatars.githubusercontent.com/u/1647935?v=4)](https://github.com/arch1t3ct "arch1t3ct (1 commits)")[![andrius-adtargetme](https://avatars.githubusercontent.com/u/4136082?v=4)](https://github.com/andrius-adtargetme "andrius-adtargetme (1 commits)")

---

Tags

numbers

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/lla-numbers-words/health.svg)

```
[![Health](https://phpackages.com/badges/lla-numbers-words/health.svg)](https://phpackages.com/packages/lla-numbers-words)
```

###  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)[rtlopez/decimal

An object oriented immutable arbitrary-precision arithmetic library for PHP

27262.8k2](/packages/rtlopez-decimal)[jurchiks/numbers2words

It spells numbers (and currencies)!

20172.1k3](/packages/jurchiks-numbers2words)[yemenifree/laravel-arabic-numbers-middleware

auto transforms arabic/eastern to eastern/arabic numbers for i.e ١٢٣٤٥٦٧٨ to 12345678

18135.4k](/packages/yemenifree-laravel-arabic-numbers-middleware)[delight-im/random

The most convenient way to securely generate anything random in PHP

2345.4k](/packages/delight-im-random)[samsara/fermat

A library providing math and statistics operations for numbers of arbitrary size.

653.1k3](/packages/samsara-fermat)

PHPackages © 2026

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