Skip to content

rakibdevs/number-to-bangla

Repository files navigation

Number to Bangla Number, Word or Month Name in Laravel

Packagist GitHub stars GitHub forks GitHub issues GitHub license MadeWithLaravel.com shield | Get Wordpress Plugin

Laravel package to convert English numbers to Bangla number or Bangla text, Bangla month name and Bangla Money Format for Laravel 5.5+. Maximum possible number to covert in Bangla word is 999999999999999 Example,

Operation English Input Bangla Output
Text (Integer) 13459 তেরো হাজার চার শত ঊনষাট
Text (Float) 1345.05 এক হাজার তিন শত পঁয়তাল্লিশ দশমিক শূন্য পাঁচ
Number 1345.5 ১৩৪৫.৫
Text Money Format 1345.50 এক হাজার তিন শত পঁয়তাল্লিশ টাকা পঞ্চাশ পয়সা
Month 12 ডিসেম্বর
Comma (Lakh) 121212121 ১২,১২,১২,১২১

Installation

Install the package through Composer. On the command line:

composer require rakibhstu/number-to-bangla

Configuration

If Laravel > v7.~, no need to add provider

Add the following to your providers array in config/app.php:

'providers' => [
    // ...

    Rakibhstu\Banglanumber\NumberToBanglaServiceProvider::class,
],

Usage

Here you can see some example of just how simple this package is to use.

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:  এক হাজার তিন শত পঁয়তাল্লিশ দশমিক শূন্য পাঁচ

Number to Bangla Word

Use bnWord() to convert any number into bangla word. Example,

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

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

Number to Bangla Money Format

Use bnMoney() to convert any number into bangla money format with 'টাকা' & 'পয়সা'. Example,

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

Number to Bangla Number

Use bnNum() to convert any number into bangla number. Example,

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

Number to Month Name in Bangla

Use bnMonth() to convert any number into bangla number. Input Limit (1-12) Example,

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

Comma separated number

Use bnCommaLakh() to convert any number into bangla number. Example,

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

License

Number to Bangla is licensed under The MIT License (MIT).