s1k3 / bangla-number-to-word
Laravel Package to convert number to bangla currency works with both english and bangla
1.0.5
2026-04-11 18:29 UTC
Requires
- php: ^8.1
- ext-intl: *
- illuminate/support: ^10.0|^11.0|^12.0|^13.0
Requires (Dev)
- orchestra/testbench: ^9.0
- pestphp/pest: ^3.0
- pestphp/pest-plugin-laravel: ^3.0
README
Laravel Library for converting number to word both for Bangla & English
Requirements This package uses the php-intl extension for English conversion.
Installation
- composer require s1k3/bangla-number-to-word
- (You may skip this step when using Laravel >= 5.5). Navigate to
config/app.phpand add to the providers array:
'providers' => [ S1K3\Bangla\Number\To\Word\NumberToWordServiceProvider::class, ]
- Publish the configuration file:
php artisan vendor:publish --provider="S1K3\Bangla\Number\To\Word\NumberToWordServiceProvider"
Helper Function
number_to_word(string $number, string $language = ''): string
| Parameter | Type | Description |
|---|---|---|
$number |
string | The numeric value to convert (integer or decimal) |
$language |
string | 'en' for English, 'bn' for Bangla. Defaults to config value |
number_to_word('123', 'bn'); // একশত তেইশ টাকা number_to_word('123', 'en'); // one hundred twenty-three taka number_to_word('1556.62', 'bn'); // এক হাজার পাঁচশত ছাপ্পান্ন টাকা বাষট্টি পয়সা number_to_word('15262', 'en'); // fifteen thousand two hundred sixty-two taka // Omit language to use the default from config/number_to_word.php number_to_word('155342262'); // পনের কোটি তিপ্পান্ন লক্ষ বিয়াল্লিশ হাজার দুইশত বাষট্টি টাকা
Blade Directive
@numberToWord($number, $language)
Use directly inside any Blade template. The language argument is optional and falls back to the config default.
{{-- With explicit language --}} @numberToWord('123', 'en') {{-- one hundred twenty-three taka --}} @numberToWord('123', 'bn') {{-- একশত তেইশ টাকা --}} {{-- With a variable --}} @numberToWord($invoice->total, 'en') {{-- Using the config default language --}} @numberToWord($invoice->total)
Configuration (config/number_to_word.php)
return [ 'language' => 'bn', // default language: 'en' or 'bn' 'unit' => [ 'en' => 'taka', 'bn' => 'টাকা', ], 'units' => [ 'en' => [ 'crore' => 'crore', 'lac' => 'lac', 'thousand' => 'thousand', 'hundred' => 'hundred', 'paisa' => 'cent', ], 'bn' => [ 'crore' => 'কোটি', 'lac' => 'লক্ষ', 'thousand' => 'হাজার', 'hundred' => 'শত', 'paisa' => 'পয়সা', ], ], ];
| Key | Description |
|---|---|
language |
Default language — 'en' (English) or 'bn' (Bangla) |
unit |
Currency name appended at the end of each result |
units |
Denomination labels used in the conversion |