cibs/currency-to-words

A PHP number to words Currency converter

Installs: 16

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 1

Forks: 0

Open Issues: 0

Type:project

pkg:composer/cibs/currency-to-words

1.0.1 2025-04-30 14:08 UTC

This package is auto-updated.

Last update: 2025-12-30 15:56:35 UTC


README

Usage

Install

composer require cibs/currency-to-words

Create an Instance

Then in your Controller or View, you can use it with an instance. \

$currencyToWords = new \CurrencyToWords\CurrencyToWords();

or Use

use CurrencyToWords\CurrencyToWords;

$ctw = new CurrencyToWords();
$amtInWords = $ctw->format(101000.56, 'en', 'Ghana Cedis', 'Pesewas');

Parameters

String $amount = "10000.56" (Required)
String $lang = "en" (Required)
String $word_currency = "United States Dollars" (Required)
String $word_unit = "Cents" (Required)
String $case = "default" (Optional)

** Currency should be changed to your preferred currency words and word units **

For Default case using ucwords()

$amtInWords = $currencyToWords->format(10000.56, 'en', 'Ghana Cedis', 'Pesewas');

For Uppercase using strtoupper()

$amtInWords = $currencyToWords->format(10000.56, 'en', 'Ghana Cedis', 'Pesewas', 'upper');

For Lowercase using strtolower()

$amtInWords = $currencyToWords->format(10000.56, 'en', 'Ghana Cedis', 'Pesewas', 'lower');

For Different Languages using PHP NumberFormatter::getLocale

Example

'en' = English, 'fr' = French, 'es' = Spanish, etc.
$amtInWords = $currencyToWords->format(10000.56, 'fr', 'Euros', 'Cents', 'lower');

Here is a complete list of PHP locales:
https://github.com/umpirsky/locale-list/blob/master/data/rw/locales.php