Search by

ediphas / bnspellnum

sakhadib

Spell out numbers in Bangla: words, currency (taka/paisa), ordinals, years and dates. Zero dependencies.

v0.1.0 2026-11-28 03:18 UTC

This package is not auto-updated.

Last update: 2026-11-28 16:31:39 UTC


README

Spell out numbers in Bangla: words, taka/paisa, ordinals, years and dates. Zero dependencies (no bcmath or gmp), PHP ≥ 8.1. Implements the bnspellnum spec 1.0.0, and gives the same output as the Python, JavaScript, C# and C++ packages.

This directory is mirrored to ediphasLabs/bnspellnum-php for Packagist. Please open issues and pull requests on the main repository.

composer require ediphas/bnspellnum
use Ediphas\BnSpellNum\BnSpellNum;

BnSpellNum::words(1250000);                    // "বারো লাখ পঞ্চাশ হাজার"
BnSpellNum::words(200, style: 'formal');       // "দুইশত"
BnSpellNum::words('-3.25');                    // "ঋণাত্মক তিন দশমিক দুই পাঁচ"
BnSpellNum::currency('1250.50', cheque: true); // "এক হাজার দুইশো পঞ্চাশ টাকা পঞ্চাশ পয়সা মাত্র"
BnSpellNum::ordinal(3, short: true);           // "৩য়"
BnSpellNum::year(1971);                        // "উনিশশো একাত্তর"
BnSpellNum::date(16, 12, 1971);                // "ষোলোই ডিসেম্বর উনিশশো একাত্তর"
BnSpellNum::date(28, 11, style: 'short');      // "২৮শে নভেম্বর"
BnSpellNum::toBnDigits('2026');                // "২০২৬"
  • Accepts int and numeric strings (ASCII or Bangla digits, , separators, one .). Floats throw InvalidInputException; pass a string instead.
  • Errors: InvalidInputException and OutOfRangeException, both extending BnSpellNumException (an \InvalidArgumentException).

Full documentation is in the project README. MIT © Ediphas Labs.