Git Product home page Git Product logo

rakibdevs / number-to-bangla Goto Github PK

View Code? Open in Web Editor NEW
74.0 1.0 36.0 73 KB

Laravel package to convert English numbers to Bangla number or Bangla text, Bangla month name and Bangla Money Format

Home Page: https://rakibdevs.github.io/number-to-bangla/

License: MIT License

PHP 100.00%
larave-package number-to-word number-to-bangla-word number-to-month-name-bangla number-to-bangla bangla laravel

number-to-bangla's Introduction

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).

number-to-bangla's People

Contributors

arif98741 avatar rakibdevs avatar smartdatasoft avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

number-to-bangla's Issues

Please modify

121| $n = preg_replace("/(\d+?)(?=(\d\d)+(\d)(?!\d))(.\d+)?/i", "$1,", $num);
122| return strtr($n,$this->numbers)

Please modify this line ending with semicolon (;)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.