PHPackages                             sikandarmoyaldev/indian-amount-formatter - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. sikandarmoyaldev/indian-amount-formatter

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

sikandarmoyaldev/indian-amount-formatter
========================================

A high-performance PHP utility package for formatting Indian currency amounts, percentages, and ranges.

1.1.2(1mo ago)07MITPHPPHP ^8.1

Since Jul 9Pushed 1mo agoCompare

[ Source](https://github.com/sikandarmoyaldev/indian-amount-formatter)[ Packagist](https://packagist.org/packages/sikandarmoyaldev/indian-amount-formatter)[ Docs](https://github.com/sikandarmoyaldev/indian-amount-formatter)[ RSS](/packages/sikandarmoyaldev-indian-amount-formatter/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (4)Dependencies (1)Versions (4)Used By (0)

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

[](#-packages)

PackageLanguageDocumentation**[packages/ts](./packages/ts)**TypeScript / Node.js[View Docs](./packages/ts/README.md)**[packages/php](./packages/php)**PHP[View Docs](./packages/php/README.md)✨ Features
----------

[](#-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
--------------

[](#-installation)

### TypeScript / Node.js

[](#typescript--nodejs)

```
npm install @sikandarmoyaldev/indian-amount-formatter
# or
pnpm add @sikandarmoyaldev/indian-amount-formatter
```

### PHP

[](#php)

```
composer require sikandarmoyaldev/indian-amount-formatter
```

📖 Usage
-------

[](#-usage)

### TypeScript

[](#typescript)

```
import * as Inr from '@sikandarmoyaldev/indian-amount-formatter';

console.log(Inr.formatAmount(200000)); // Output: ₹2 Lakh
console.log(Inr.formatAmount(4999)); // Output: ₹4.99K
console.log(Inr.formatAmount(null)); // Output: Unlimited
console.log(Inr.formatPercentage(3.5)); // Output: 3.5%
console.log(Inr.formatAmountRange(100000, 500000)); // Output: ₹1 Lakh - ₹5 Lakh
console.log(Inr.formatAmountWithActual(140000)); // Output: ₹1.4 Lakh (₹1,40,000)
```

### PHP

[](#php-1)

```
use Sikandarmoyaldev\IndianAmountFormatter\InrFormatter as Inr;

echo Inr::formatAmount(200000); // Output: ₹2 Lakh
echo Inr::formatAmount(4999); // Output: ₹4.99K
echo Inr::formatAmount(null); // Output: Unlimited
echo Inr::formatPercentage(3.5); // Output: 3.5%
echo Inr::formatAmountRange(100000, 500000); // Output: ₹1 Lakh - ₹5 Lakh
echo Inr::formatAmountWithActual(140000); // Output: ₹1.4 Lakh (₹1,40,000)
```

💡 API Reference
---------------

[](#-api-reference)

MethodDescriptionExample 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: true` or `round: false`.

🛠️ Development
--------------

[](#️-development)

This project uses a monorepo structure managed by `pnpm` (for TypeScript) and `composer` (for PHP).

### Prerequisites

[](#prerequisites)

- Node.js (v18 or higher)
- pnpm
- PHP (v8.1 or higher)
- Composer

### Setup

[](#setup)

```
# Install root and TypeScript dependencies
pnpm install

# Install PHP dependencies
pnpm run php install
```

🧪 Running Tests
---------------

[](#-running-tests)

```
# Run all tests (TypeScript + PHP)
pnpm test

# Run only TypeScript tests (Vitest)
pnpm run test:ts

# Run only PHP tests (PHPUnit)
pnpm run test:php
```

🎨 Formatting Code
-----------------

[](#-formatting-code)

We use Prettier globally to format TS, JS, JSON, MD, and PHP files.

```
# Format all files
pnpm format

# Check if files are formatted correctly (used in CI)
pnpm format:check
```

📄 License
---------

[](#-license)

This project is licensed under the MIT [License](LICENSE) - see the LICENSE file for details.

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance90

Actively maintained with recent releases

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

3

Last Release

49d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/06d0335f92cfcc215017099415bc31b6638ac097a5221bd0f8955aebd84aced7?d=identicon)[sikandarmoyaldev](/maintainers/sikandarmoyaldev)

---

Top Contributors

[![sikandarmoyaldev](https://avatars.githubusercontent.com/u/165464126?v=4)](https://github.com/sikandarmoyaldev "sikandarmoyaldev (19 commits)")

---

Tags

phpformattermoneycurrencyformattingindiaINRrupeelakhcrore

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/sikandarmoyaldev-indian-amount-formatter/health.svg)

```
[![Health](https://phpackages.com/badges/sikandarmoyaldev-indian-amount-formatter/health.svg)](https://phpackages.com/packages/sikandarmoyaldev-indian-amount-formatter)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
