laravel-bangla maintained by fringebyte
Every Bangladeshi app ends up writing these helpers again: a receipt that needs the amount in words, a report that must show ১৯,৬৪,০০০ instead of 1,964,000, a form that has to accept +880 1712-345678 and ০১৭১২৩৪৫৬৭৮ as the same number. This package does them once, properly, with tests.
- Zero dependencies — plain PHP 8.2+. Laravel is optional.
- Lakh/crore grouping, half-up rounding, and string amounts handled digit by digit, so large values never lose precision.
- Laravel extras (auto-discovered): Blade directives, a
bd_mobilevalidation rule with English and Bangla messages, and helper functions. - Extracted from production systems that print receipts, vouchers and member statements every day.
Installation
composer require fringebyte/laravel-bangla
Usage
use FringeByte\Bangla\Bangla;
use FringeByte\Bangla\BdPhone;
Taka & numbers
Bangla::taka(1964000); // ৳ ১৯,৬৪,০০০
Bangla::taka(1250.5); // ৳ ১,২৫০.৫০
Bangla::taka(-2500); // -৳ ২,৫০০
Bangla::taka(1964000, symbol: false); // ১৯,৬৪,০০০
Bangla::taka(1964000, bangla: false); // ৳ 19,64,000
Bangla::number(1234567, bangla: false); // 12,34,567
Bangla::number(1234, decimals: 2); // ১,২৩৪.০০
Bangla::number('98765432109876543210'); // ৯,৮৭,৬৫,৪৩,২১,০৯,৮৭,৬৫,৪৩,২১০ — no float rounding
Amounts may be int, float, numeric string (commas, ৳ and Bangla digits allowed) or null (treated as 0). Anything else throws InvalidArgumentException.
Amount in words — for receipts, cheques and vouchers
Bangla::inWords(801550); // আট লক্ষ এক হাজার পাঁচ শত পঞ্চাশ টাকা মাত্র
Bangla::inWords(1250.5); // এক হাজার দুই শত পঞ্চাশ টাকা পঞ্চাশ পয়সা মাত্র
Bangla::inWords(0.75); // পঁচাত্তর পয়সা মাত্র
Bangla::words(12345678); // এক কোটি তেইশ লক্ষ পঁয়তাল্লিশ হাজার ছয় শত আটাত্তর
All 100 words below one hundred are written out individually (একাত্তর, নিরানব্বই …), never assembled from parts.
Digits
Bangla::digits(2026); // ২০২৬
Bangla::digits('M-004'); // M-০০৪
Bangla::toEnglishDigits('০১৭১১'); // 01711 — for input typed on a Bangla keyboard
Dates
Bangla::date('2026-12-04'); // ০৪ ডিসে ২০২৬
Bangla::date('2026-12-04', long: true); // ৪ ডিসেম্বর ২০২৬
Bangla::dateTime('2026-12-04 22:13'); // ০৪ ডিসে ২০২৬, ১০:১৩ PM
Bangla::dayName('2026-12-04'); // শুক্রবার
Bangla::monthName(2); // ফেব্রুয়ারি
Bangla::monthRange('2026-10-01', '2026-12-31'); // অক্টো–ডিসে ২০২৬
Bangla::ago('2026-11-22'); // ১২ দিন আগে · আজ · গতকাল · আগামীকাল · ৩ মাস আগে · ২ বছর পরে
Dates may be a DateTimeInterface (Carbon included), a date string or a Unix timestamp. ago() counts calendar days, so 11 pm yesterday is গতকাল even if it was two hours ago.
Bangladeshi mobile numbers
BdPhone::normalize('+880 1712-345678'); // 01712345678
BdPhone::normalize('০১৭১২৩৪৫৬৭৮'); // 01712345678
BdPhone::normalize('029876543'); // null — not a mobile number
BdPhone::isValid('8801712345678'); // true
BdPhone::international('01712345678'); // 8801712345678 (wa.me links, SMS gateways)
BdPhone::format('01712345678'); // 01712-345678
BdPhone::operator('01812345678'); // Robi
Store BdPhone::normalize($input) and every way of writing the same number matches. operator() goes by prefix, so a number moved to another operator (MNP) still shows its original one.
Laravel
The service provider is auto-discovered.
Blade
@taka($invoice->total) {{-- ৳ ১৯,৬৪,০০০ --}}
@takaInWords($invoice->total) {{-- … টাকা মাত্র --}}
@banglaDigits($member->number)
@banglaDate($payment->paid_on)
Output is escaped like {{ }}.
Validation
$request->validate([
'mobile' => ['required', 'bd_mobile'],
]);
// or the rule object
use FringeByte\Bangla\Rules\BdMobile;
'mobile' => ['required', new BdMobile],
The error message is in English or Bangla depending on the app locale (মোবাইল সঠিক বাংলাদেশি মোবাইল নম্বর নয়।). Publish the translations to change it:
php artisan vendor:publish --tag=bangla-translations
Helpers
taka(246000); // ৳ ২,৪৬,০০০
taka_in_words(15000); // পনেরো হাজার টাকা মাত্র
bangla_digits(2026); // ২০২৬
bangla_date($date); // ০৪ ডিসে ২০২৬
Each helper is only defined if a function with the same name does not already exist.
বাংলায় সংক্ষেপে
বাংলাদেশি অ্যাপে বারবার লাগে এমন কাজগুলো এক প্যাকেজে, টেস্টসহ:
- টাকা লাখ-কোটি অনুযায়ী:
৳ ১৯,৬৪,০০০ - টাকার অঙ্ক কথায়: রসিদ ও ভাউচারের জন্য "আট লক্ষ এক হাজার পাঁচ শত পঞ্চাশ টাকা মাত্র"
- বাংলা অঙ্ক আর তারিখ:
০৪ ডিসে ২০২৬, "৩ দিন আগে" - মোবাইল নম্বর: যেভাবেই লেখা হোক, এক রূপে
01712345678; অপারেটর চেনা যায় - Laravel: Blade directive, বাংলা ও ইংরেজি বার্তাসহ
bd_mobilevalidation rule
কোনো সমস্যা বা প্রস্তাব থাকলে issue খুলুন।
Testing
composer test # PHPUnit
composer analyse # PHPStan, level max
composer format # Laravel Pint
CI runs the suite on PHP 8.2 – 8.5 with Laravel 12 and 13.
Roadmap
- Bangla calendar (বঙ্গাব্দ) using Bangladesh's revised calendar:
৪ ডিসে ২০২৬→১৯ অগ্রহায়ণ ১৪৩৩
Credits
Built by Md. Azizul Haque Sohel at FringeByte Technologies.
License
MIT. See LICENSE.