PHPackages                             ziedelifa/num-to-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. ziedelifa/num-to-words

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

ziedelifa/num-to-words
======================

Multi language standalone PHP number to words converter. Fully tested, open for extensions and new languages.

19.0k—10%PHP

Since Aug 20Pushed 6y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

PHP Number to words converter
=============================

[](#php-number-to-words-converter)

[![Travis](https://camo.githubusercontent.com/0fe35facd1d808477b37b09f5f2561b6c6b350e88888265af5efe3dab595173a/68747470733a2f2f7472617669732d63692e6f72672f6b776e2f6e756d6265722d746f2d776f7264732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/kwn/number-to-words)[![Code Climate](https://camo.githubusercontent.com/37f42466de97afafa1ff8a9cad754c8cba0d1529197c20d295948643bfa296af/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f6b776e2f6e756d6265722d746f2d776f7264732f6261646765732f6770612e737667)](https://codeclimate.com/github/kwn/number-to-words)[![Test Coverage](https://camo.githubusercontent.com/bf15f32acd151cb8c42d212671fa5f7aefe4efe5f1f1b278d4e9969c46c92643/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f6b776e2f6e756d6265722d746f2d776f7264732f6261646765732f636f7665726167652e737667)](https://codeclimate.com/github/kwn/number-to-words/coverage)[![Latest Stable Version](https://camo.githubusercontent.com/906524ac428c9b0c1a0077b8d17e18aab057d0692ed6d88f360187c192a84e08/68747470733a2f2f706f7365722e707567782e6f72672f6b776e2f6e756d6265722d746f2d776f7264732f762f737461626c65)](https://packagist.org/packages/kwn/number-to-words)

This library allows you to convert a number to words.

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

[](#installation)

Add package to your composer.json by running:

```
$ composer require ziedelifa/num-to-words

```

Usage
-----

[](#usage)

This library currently has two types of number-to-words transformations: number and currency. In order to use a specific transformer for certain language you need to create an instance of `NumToWords` class and then call a method which creates a new instance of a transformer;

### Number Transformer

[](#number-transformer)

Before using a transformer, it must be created:

```
use NumToWords\NumToWords;

// create the number to words "manager" class
$numberToWords = new NumToWords();

// build a new number transformer using the RFC 3066 language identifier
$numberTransformer = $numberToWords->getNumberTransformer('en');
```

Then it can be used passing in numeric values to the `toWords()` method:

```
$numberTransformer->toWords(5120); // outputs "five thousand one hundred twenty"
```

### Currency Transformer

[](#currency-transformer)

Creating a currency transformer works just like a number transformer.

```
use NumToWords\NumToWords;

// create the number to words "manager" class
$numberToWords = new NumToWords();

// build a new currency transformer using the RFC 3066 language identifier
$currencyTransformer = $numberToWords->getCurrencyTransformer('en');
```

Then it can be used passing in numeric values for amount and ISO 4217 currency identifier to the `toWords()` method:

```
$currencyTransformer->toWords(5099, 'USD'); // outputs "fifty dollars ninety nine cents"
```

Bare in mind, the currency transformer accepts integers as the amount to transform. It means that if you store amounts as floats (e.g. 4.99) you need to multiply them by 100 and pass the integer (499) as an argument.

Available locale
----------------

[](#available-locale)

LanguageIdentifierNumberCurrencyBelgian Frenchfr\_BE+-Brazilian Portuguesept\_BR++Bulgarianbg+-Czechcs+-Danishdk++Dutchnl+-Englishen++Estonianet+-Georgianka++Germande++Frenchfr++Hungarianhu++Indonesianid+-Italianit+-Lithuanianlt+-Latvianlv+-Malayms+-Polishpl++Romanianro++Slovaksk+-Spanishes++Russianru++Swedishsv+-Turkishtr++Turkmentk++Ukrainianua++Contributors
------------

[](#contributors)

Most of the transformers were ported from `pear/Numbers_Words` library. Some of them were slightly refactored. Some of them were created by other [contributors](https://github.com/ziedelifa/num-to-words/graphs/contributors) who were helping me with the initial version of that library.

This library is still under a heavy refactoring so the legacy code should ultimately disappear.

Questions and answers
---------------------

[](#questions-and-answers)

**Q: Why the code looks like a crap? Why it gets so low rank on code climate?**

A: Most of the code was just migrated from `pear/Numbers_Words`. That library still remembers the ages of PHP4. I constantly refactor it, so it's getting better. I'm also porting some mechanisms from other languages so sooner or later it will look quite good.

**Q: There's an error!**

A: Please report an issue, or even better - create a pull request. I don't speak most of those languages so your help is much appreciated. Thanks!

**Q: Why there are some transformers which cannot be used (they live under `UntestedLocale` namespace)?**

A: Simply, because there are no test cases for them. You're more than welcome to create some test cases for them, so we'll be able to include them in a list of available languages.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/1bf3967035b7bc4813396f2e956c5fc73c2ff8dff38c8d094648fdae9a15911c?d=identicon)[ziedelifa](/maintainers/ziedelifa)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/ziedelifa-num-to-words/health.svg)

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

###  Alternatives

[openlss/lib-array2xml

Array2XML conversion library credit to lalit.org

31052.5M47](/packages/openlss-lib-array2xml)[makeusabrew/bootbox

Wrappers for JavaScript alert(), confirm() and other flexible dialogs using the Bootstrap framework

5.0k109.4k2](/packages/makeusabrew-bootbox)[jmikola/geojson

GeoJSON implementation for PHP

3109.0M77](/packages/jmikola-geojson)[apy/datagrid-bundle

Symfony Datagrid Bundle

502998.7k9](/packages/apy-datagrid-bundle)[gee-team/gt-php-sdk

GtWeb Php Demo

1165.1k4](/packages/gee-team-gt-php-sdk)[silvershop/silverstripe-listsorter

Easily provide front-end sorting controls for SilverStripe lists

1640.8k4](/packages/silvershop-silverstripe-listsorter)

PHPackages © 2026

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