cibs/currency-to-words
最新稳定版本:1.0.1
Composer 安装命令:
composer create-project cibs/currency-to-words
包简介
A PHP number to words Currency converter
README 文档
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
统计信息
- 总下载量: 16
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-02-01