Download the PHP package sikandarmoyaldev/indian-amount-formatter without Composer
On this page you can find all versions of the php package sikandarmoyaldev/indian-amount-formatter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download sikandarmoyaldev/indian-amount-formatter
More information about sikandarmoyaldev/indian-amount-formatter
Files in sikandarmoyaldev/indian-amount-formatter
Package indian-amount-formatter
Short Description A high-performance PHP utility package for formatting Indian currency amounts, percentages, and ranges.
License MIT
Homepage https://github.com/sikandarmoyaldev/indian-amount-formatter
Informations about the package indian-amount-formatter
Indian Amount Formatter
A high-performance, dual-language utility package for formatting Indian currency amounts, percentages, and ranges.
This monorepo contains native implementations for both TypeScript and PHP, guaranteed to behave identically via shared test fixtures.
๐ Packages
| Package | Language | Documentation |
|---|---|---|
| packages/ts | TypeScript / Node.js | View Docs |
| packages/php | PHP | View Docs |
โจ Features
- Standardized Indian currency short-form: K, Lakh, Cr.
- Percentage formatting: Automatic trailing zero removal.
- Range formatting: For min/max values (e.g.,
โน1 Lakh - โน5 Lakh). - Transparent formatting: Shows both short-form and actual numeric values.
- 100% native performance: Zero FFI overhead in both languages.
- Guaranteed behavioral parity: Verified via shared JSON test fixtures.
๐ฆ Installation
TypeScript / Node.js
PHP
๐ Usage
TypeScript
PHP
๐ก API Reference
| Method | Description | Example Output |
|---|---|---|
formatAmount(amount, prefix?, options?) |
Formats a numeric amount into Indian short-form. | โน2 Lakh, โน4.99K |
formatPercentage(value, options?) |
Formats a percentage, removing trailing zeros. | 3.5%, 10% |
formatAmountRange(min, max, prefix?, options?) |
Formats a range of amounts. | โน1 Lakh - โน5 Lakh |
formatAmountWithActual(amount, prefix?, options?) |
Formats amount showing both short and actual values. | โน1.4 Lakh (โน1,40,000) |
Note: You can also use the InrFormatter class to configure options like
round: trueorround: false.
๐ ๏ธ Development
This project uses a monorepo structure managed by pnpm (for TypeScript) and composer (for PHP).
Prerequisites
- Node.js (v18 or higher)
- pnpm
- PHP (v8.1 or higher)
- Composer
Setup
๐งช Running Tests
๐จ Formatting Code
We use Prettier globally to format TS, JS, JSON, MD, and PHP files.
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.