nihar/num2word-bd

该软件包可以将数字根据孟加拉国数字系统转换为文字

v1.0.0 2023-12-28 08:03 UTC

This package is auto-updated.

Last update: 2024-09-28 09:53:42 UTC


README

NUM2WORD-BD 是一个根据孟加拉国数字系统进行数字到文字转换的库

要求

  • PHP 8.0 及以上。

安装

要运行此示例,您需要在安装此库之前。可以通过两种不同的方法完成:

1. 使用 Composer

您可以通过 Composer 安装库。

composer require nihar/num2word-bd

请参阅以下配置部分进行配置。

用法

要将数字转换为文字,请按照以下步骤操作:

use Nihar\Num2wordBd\Formatter;

// Instantiate the Formatter class
$formatter = new Formatter();

// Call the format method and pass the number you want to convert
$result = $formatter
    ->currency('TK')
    ->fractionCurrency('Paysa')
    ->joinSign('&')
    ->format(1234.56);

echo $result; // Outputs: "One Thousand Two Hundred Thirty Four TK & Fifty Six Paysa"

可用方法

  • format($number): 将提供的数字转换为它的文字表示形式。
  • currency($sign): 为整个数字部分设置货币符号。
  • fractionCurrency($sign): 为小数部分设置货币符号。
  • joinSign($sign): 设置符号以连接整个部分和小数部分。

贡献

欢迎贡献!以下是您可以如何为此项目做出贡献:

  1. 复制存储库
  2. 创建您的功能分支(git checkout -b feature/YourFeature)
  3. 提交您的更改(git commit -m '添加某些功能')
  4. 将更改推送到分支(git push origin feature/YourFeature)
  5. 打开拉取请求

许可证

MIT 许可证(MIT):请参阅许可证文件