PHPackages                             jcabanillas/number-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. jcabanillas/number-to-words

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

jcabanillas/number-to-words
===========================

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

024PHP

Since Jan 13Pushed 1y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

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

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

[![CircleCI](https://camo.githubusercontent.com/d6353dd31529d89d2fb43a0ead128310fa3bf513887f1040b81cc9ce870dfc94/68747470733a2f2f646c2e636972636c6563692e636f6d2f7374617475732d62616467652f696d672f67682f6a636162616e696c6c61732f6e756d6265722d746f2d776f7264732f747265652f6d61737465722e7376673f7374796c653d736869656c64)](https://dl.circleci.com/status-badge/redirect/gh/jcabanillas/number-to-words/tree/master)[![Code Climate](https://camo.githubusercontent.com/2bad5ad1cbee85c5ed3df26a84d0c0b340d85395698461c36d900f73db195c11/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f6a636162616e696c6c61732f6e756d6265722d746f2d776f7264732f6261646765732f6770612e737667)](https://codeclimate.com/github/jcabanillas/number-to-words)[![Test Coverage](https://camo.githubusercontent.com/e3fe3d80d532fcff5c148ead876ab780bc101a8343bccd55b97a35a6b3851479/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f6a636162616e696c6c61732f6e756d6265722d746f2d776f7264732f6261646765732f636f7665726167652e737667)](https://codeclimate.com/github/jcabanillas/number-to-words/coverage)[![Latest Stable Version](https://camo.githubusercontent.com/cbf53e74580eb11293c6b402cf53da9c5c21f3d3e829da8aee6ee7a4f5b7b824/68747470733a2f2f706f7365722e707567782e6f72672f6a636162616e696c6c61732f6e756d6265722d746f2d776f7264732f762f737461626c65)](https://packagist.org/packages/jcabanillas/number-to-words)

Welcome to `number-to-words`, a PHP utility that seamlessly transforms numeric values into their corresponding words. Effortlessly convert numbers, such as 123, into expressive and readable formats like "one hundred and twenty-three" with just a few lines of code.

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

[](#installation)

Add package to your composer.json by running:

```
$ composer require jcabanillas/number-to-words

```

Usage
-----

[](#usage)

There are two types of number-to-words transformation: number and currency. In order to use a relevant transformer for specific language create an instance of `NumberToWords` class and call a method that creates a new instance of the desired transformer;

### Number Transformer

[](#number-transformer)

Create a transformer for specific language using the `getNumberTransformer('lang')` method:

```
use NumberToWords\NumberToWords;

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

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

Transformer can be used by passing in numeric values to the `toWords()` method:

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

It can be also used with a static method:

```
NumberToWords::transformNumber('en', 5120); // outputs "five thousand one hundred twenty"
```

### Currency Transformer

[](#currency-transformer)

Creating a currency transformer works just like a number transformer.

```
use NumberToWords\NumberToWords;

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

// 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"
```

It can be also used with a static method:

```
NumberToWords::transformCurrency('en', 5099, 'USD'); // outputs "fifty dollars ninety nine cents"
```

Note: The Currency Transformer within this library processes integers; ensure your input amounts are in whole numbers by multiplying any float values by 100 before transformation. For instance, transform 45.67 by using 4567 as the input for accurate currency conversion.

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

[](#available-locale)

LanguageIdentifierNumberCurrencyAliasAlbanianal++Arabicar++Azerbaijaniaz++Belgian Frenchfr\_BE+-Brazilian Portuguesept\_BR++Bulgarianbg++Czechcs+-Danishdk++Dutchnl+-Englishen++Estonianet+-Georgianka++Germande++Frenchfr++fr\_FRHungarianhu++Indonesianid++Italianit+-Kurdishku+-Lithuanianlt++Latvianlv++Macedonianmk+-Malayms++Persianfa+-Polishpl++Romanianro++Serbiansr++Slovaksk++Spanishes++Russianru++Swahilisw++Swedishsv+-Turkishtr++Turkmentk++Ukrainianua++Uzbekuz++Yorubayo++Contributors
------------

[](#contributors)

Some transformers were ported from the `pear/Numbers_Words` library. Others were created by [contributors](https://github.com/jcabanillas/number-to-words/graphs/contributors). Thank you!

Version 2.x - BC and major changes
----------------------------------

[](#version-2x---bc-and-major-changes)

- Dropped support for PHP &lt;7.4.
- Added typehints for `NumberTransformer` and `CurrencyTransformer` interfaces. Now both accept integer numbers only (Albanian language might be affected).
- Added support for PSR12.

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

[](#questions-and-answers)

**Q: What should I do if I encounter a bug while using the library?**

A: If you come across a bug, please open an issue on our GitHub repository. As I may not be proficient in all languages, we encourage users to submit fixes and collaborate to enhance the library's functionality.

**Q: My language is missing. Could it be added?**

A: There's a high chance I don't know your language. Feel free to implement the missing language and open a pull request. You can use the existing languages as a reference.

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance32

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity16

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/f7795c713460c1b84d1432aecd5ab418b0f5ee57edd01fb1726b2acefa13d18c?d=identicon)[jcabanillas](/maintainers/jcabanillas)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/jcabanillas-number-to-words/health.svg)

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

###  Alternatives

[verbb/field-manager

Manage your fields and field groups with ease.

197607.5k10](/packages/verbb-field-manager)[naneau/php-obfuscator

A basic but functional PHP obfuscator for object oriented PHP

6023.6k](/packages/naneau-php-obfuscator)[lukasbesch/bedrock-plugin-disabler

Disable certain plugins in non-production environments using PHP constants.

5585.7k](/packages/lukasbesch-bedrock-plugin-disabler)[lara-zeus/inline-chart

Zeus Inline Chart easily add a chart in filamentPHP table column

2139.9k](/packages/lara-zeus-inline-chart)[ruskid/yii2-ip-behavior

Yii2 Behavior that records User IP address on Updates/Inserts

109.9k](/packages/ruskid-yii2-ip-behavior)

PHPackages © 2026

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