rakibhstu/number-to-bangla

Laravel 包,用于将英语数字转换为孟加拉语数字或孟加拉语文本,孟加拉语月份名称和孟加拉语货币格式

v1.5.0 2023-01-13 15:03 UTC

README

Packagist GitHub stars GitHub forks GitHub issues GitHub license MadeWithLaravel.com shield | 获取 WordPress 插件

Laravel 包,用于将英语数字转换为孟加拉语数字或孟加拉语文本,孟加拉语月份名称和孟加拉语货币格式(适用于 Laravel 5.5+)。可以转换为孟加拉语单词的最大数字为 999999999999999,例如:

安装

通过 Composer 安装此包。在命令行中

composer require rakibhstu/number-to-bangla

配置

如果 Laravel > v7.~, 则无需添加提供程序

将以下内容添加到您的 providers 数组中的 config/app.php

'providers' => [
    // ...

    Rakibhstu\Banglanumber\NumberToBanglaServiceProvider::class,
],

用法

在这里,您可以看到这个包如何简单易用的一些示例。

use Rakibhstu\Banglanumber\NumberToBangla;

$numto = new NumberToBangla();

// If you want to convert any number (Integer of Float) into Bangla Word
$text = $numto->bnWord(13459);    // Output:  তেরো হাজার চার শত ঊনষাট
$text = $numto->bnWord(1345.05);  // Output:  এক হাজার তিন শত পঁয়তাল্লিশ দশমিক শূন্য পাঁচ

数字转换为孟加拉语单词

使用 bnWord() 将任何数字转换为孟加拉语单词。例如:

// Integer
$text = $numto->bnWord(13459);    // Output:  তেরো হাজার চার শত ঊনষাট

// Float
$text = $numto->bnWord(1345.05);    // Output: এক হাজার তিন শত পঁয়তাল্লিশ দশমিক শূন্য পাঁচ
$text = $numto->bnWord(345675.105); // Output: তিন লক্ষ পঁয়তাল্লিশ হাজার ছয় শত পঁচাত্তর দশমিক এক শূন্য পাঁচ

数字转换为孟加拉语货币格式

使用 bnMoney() 将任何数字转换为带有 'টাকা' & 'পয়সা' 的孟加拉语货币格式。例如:

$text = $numto->bnMoney(13459);     // Output:  তেরো হাজার চার শত ঊনষাট টাকা
$text = $numto->bnMoney(13459.05);  // Output:  তেরো হাজার চার শত ঊনষাট টাকা পাঁচ পয়সা
$text = $numto->bnMoney(13459.5);   // Output:  তেরো হাজার চার শত ঊনষাট টাকা পঞ্চাশ পয়সা

数字转换为孟加拉语数字

使用 bnNum() 将任何数字转换为孟加拉语数字。例如:

$text = $numto->bnNum(13459);    // Output:  ১৩৪৫৯
$text = $numto->bnNum(2334.768); // Output:  ২৩৩৪.৭৬৮

数字转换为孟加拉语月份名称

使用 bnMonth() 将任何数字转换为孟加拉语数字。输入限制(1-12)例如:

$text = $numto->bnMonth(1);    // Output:  জানুয়ারি 
$text = $numto->bnMonth(4);    // Output:  এপ্রিল

以逗号分隔的数字

使用 bnCommaLakh() 将任何数字转换为孟加拉语数字。例如:

$text = $numto->bnCommaLakh(12121212);    // Output:  ১,২১,২১,২১২

许可证

Number to Bangla 适用于 MIT 许可证 (MIT)