PHPackages                             cable8mm/n-format - 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. cable8mm/n-format

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

cable8mm/n-format
=================

Small NumberFormatter Extension Library

v1.3.0(1y ago)21.0kMITPHPPHP ^8.0CI failing

Since Jun 15Pushed 1y ago1 watchersCompare

[ Source](https://github.com/cable8mm/n-format)[ Packagist](https://packagist.org/packages/cable8mm/n-format)[ RSS](/packages/cable8mm-n-format/feed)WikiDiscussions main Synced 6d ago

READMEChangelog (7)Dependencies (2)Versions (8)Used By (0)

N-Format
========

[](#n-format)

[![code-style](https://github.com/cable8mm/n-format/actions/workflows/code-style.yml/badge.svg)](https://github.com/cable8mm/n-format/actions/workflows/code-style.yml)[![run-tests](https://github.com/cable8mm/n-format/actions/workflows/run-tests.yml/badge.svg)](https://github.com/cable8mm/n-format/actions/workflows/run-tests.yml)[![Packagist Version](https://camo.githubusercontent.com/3e656d7b494b620834cd1edfced069f337eca338b6229ced5ab7c474e3c097aa/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6361626c65386d6d2f6e2d666f726d6174)](https://camo.githubusercontent.com/3e656d7b494b620834cd1edfced069f337eca338b6229ced5ab7c474e3c097aa/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6361626c65386d6d2f6e2d666f726d6174)[![Packagist Downloads](https://camo.githubusercontent.com/51ddd7e0e8875932cde07fb7a0a3cfa874857c25c3fea89754ae3bb5aacbd4bb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6361626c65386d6d2f6e2d666f726d6174)](https://camo.githubusercontent.com/51ddd7e0e8875932cde07fb7a0a3cfa874857c25c3fea89754ae3bb5aacbd4bb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6361626c65386d6d2f6e2d666f726d6174)[![Packagist Dependency Version](https://camo.githubusercontent.com/1185fd1f7ff1e2be5d15e162a90386eff7b04511cef9ee5c086177f2fed335ad/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f6361626c65386d6d2f6e2d666f726d61742f706870)](https://camo.githubusercontent.com/1185fd1f7ff1e2be5d15e162a90386eff7b04511cef9ee5c086177f2fed335ad/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f6361626c65386d6d2f6e2d666f726d61742f706870)[![Packagist Stars](https://camo.githubusercontent.com/28226a9e1f81a10f4d46c6b8288bfa6e3c4dd727e36ee1bc85c827ae9e8f9e12/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f73746172732f6361626c65386d6d2f6e2d666f726d6174)](https://camo.githubusercontent.com/28226a9e1f81a10f4d46c6b8288bfa6e3c4dd727e36ee1bc85c827ae9e8f9e12/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f73746172732f6361626c65386d6d2f6e2d666f726d6174)[![Packagist License](https://camo.githubusercontent.com/eaea2dc4c5abc85fe232a365aecf44fedb00287481c76999305892af85945689/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6361626c65386d6d2f6e2d666f726d6174)](https://camo.githubusercontent.com/eaea2dc4c5abc85fe232a365aecf44fedb00287481c76999305892af85945689/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6361626c65386d6d2f6e2d666f726d6174)

PHP already includes NumberFormat classes and functions, but they may not be available for some countries like Korea and Japan. Therefore, we provide a small wrapper library to extend NumberFormat, similar to how Carbon extends DateTime. Additionally, some additional functions have been provided.

If you have used Laravel, you could use `NFormatHelper` helper class. Refer to the [Usage Laravel Helper](#laravel-helper) section.

We have provided the API Documentation on the web. For more information, please visit  ❤️

Install
-------

[](#install)

```
composer require cable8mm/n-format
```

Usage
-----

[](#usage)

General:

```
print NFormat::currency(358762);
// default locale = 'ko_KR' currency = 'KRW'
//=> ₩358,762
```

```
print NFormat::spellOut(5);
// default locale = 'ko_KR' currency = 'KRW'
//=> 오
```

```
NFormat::$locale = 'ja_JP';

print NFormat::spellOut(5);
//=> 五
```

```
print NFormat::decimal(12346);
//=> 12,346

print NFormat::percent(12346);
//=> 1,234,600%

print NFormat::rawPercent(12346);
//=> 12,346%
```

New special method `ordinalSpellOut` and `currencySpellOut`(only ko\_KR):

```
print NFormat::ordinalSpellOut(10);
//=> 열번째

print NFormat::currencySpellOut(12346);
//=> 12,346 원
```

You can also use `price()` and `smartPrice()` to calculate the price for customers.

```
print NFormat::price(12346, -2);
//=> 12300

print NFormat::price(12346.23, 1);
//=> 12346.20

print NFormat::smartPrice(12346);
//=> 12300

print NFormat::smartPrice(123467);
//=> 123000

print NFormat::smartPrice(1234678);
//=> 1230000

print NFormat::smartPrice(12346432);
//=> 12350000

print NFormat::smartPrice(3212343232);
//=> 3212340000
```

### Laravel Helper

[](#laravel-helper)

You can utilize this in Laravel Blade without any need for installation:

```
{{ NFormatHelper::currency(12346) }}
```

Formatting
----------

[](#formatting)

```
composer lint
# Modify all files to comply with the PSR-12.

composer inspect
# Inspect all files to ensure compliance with PSR-12.
```

Test
----

[](#test)

```
composer test
```

License
-------

[](#license)

The N-Format is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance44

Moderate activity, may be stable

Popularity20

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity65

Established project with proven stability

 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 ~286 days

Recently: every ~425 days

Total

7

Last Release

446d ago

PHP version history (4 changes)v1.0PHP &gt;=7.2

v1.1PHP ^7.2.5

v1.2.1PHP ^7.2.5|^8.0

v1.2.2PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/c910c874a0263a18f9f976273054cd45faa3ffbcba7891992f4ab52d0656dd93?d=identicon)[Sam Lee](/maintainers/Sam%20Lee)

---

Top Contributors

[![cable8mm](https://avatars.githubusercontent.com/u/2672043?v=4)](https://github.com/cable8mm "cable8mm (33 commits)")

---

Tags

currencyformatterlocalenumberphpphpTDDextensionnumber-formattern-format

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/cable8mm-n-format/health.svg)

```
[![Health](https://phpackages.com/badges/cable8mm-n-format/health.svg)](https://phpackages.com/packages/cable8mm-n-format)
```

###  Alternatives

[rubix/tensor

A library and extension that provides objects for scientific computing in PHP.

2751.4M5](/packages/rubix-tensor)[memio/spec-gen

phpspec extension for better code generation

66204.3k28](/packages/memio-spec-gen)[phpxmlrpc/polyfill-xmlrpc

A pure-php reimplementation of the API exposed by the native XML-RPC extension

12369.8k2](/packages/phpxmlrpc-polyfill-xmlrpc)

PHPackages © 2026

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