Download the PHP package kwn/number-to-words without Composer
On this page you can find all versions of the php package kwn/number-to-words. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
All versions of number-to-words with dependencies
Informations about the package number-to-words
PHP Number to words converter
This library allows you to convert a number to words.
Add package to your composer.json by running:
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
NumberToWords class and then call a method which creates a new instance of a transformer;
Before using a transformer, it must be created:
Then it can be used passing in numeric values to the
Creating a currency transformer works just like a number transformer.
Then it can be used passing in numeric values for amount and ISO 4217 currency identifier to the
Please bear 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.
Many transformers were ported from the
pear/Numbers_Words library. Some of them were created from scratch by contributors. Thank you!
Version 2.x - BC and major changes
- Dropped support for PHP <7.4.
- Added typehints for
CurrencyTransformerinterfaces. Now both accept integer numbers only (Albanian language might be affected).
- Added support for PSR12.
Questions and answers
Q: I found a bug. What should I do?
A: Please report an issue on GitHub. Also feel free to fix it and open a pull request. I don't know most of those languages that the library supports, so your help and contribution would be much appreciated. Thanks!
Q: My language is missing. Could you add it, please?
A: Unfortunately, there's a high chance I don't know your language. Feel free to implement the missing transformer and open a pull request. You can take a look at the existing transformers, and follow the same pattern as other languages do.