PHPackages                             davidvandertuijn/number\_format\_precision - 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. davidvandertuijn/number\_format\_precision

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

davidvandertuijn/number\_format\_precision
==========================================

Number Format Precision

1.0(3y ago)052MITPHPPHP &gt;=7.1.0

Since Jan 8Pushed 1y ago1 watchersCompare

[ Source](https://github.com/davidvandertuijn/number_format_precision)[ Packagist](https://packagist.org/packages/davidvandertuijn/number_format_precision)[ RSS](/packages/davidvandertuijn-number-format-precision/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Number Format Precision
=======================

[](#number-format-precision)

[![Total Downloads](https://camo.githubusercontent.com/388852946b37b388dccaeb9b2f3761aadba98d98c47e1f38d7684a2b222aa109/68747470733a2f2f706f7365722e707567782e6f72672f646176696476616e6465727475696a6e2f6e756d6265725f666f726d61745f707265636973696f6e2f642f746f74616c2e737667)](https://packagist.org/packages/davidvandertuijn/number_format_currency)[![Latest Stable Version](https://camo.githubusercontent.com/31c5c244549505c4865c6b40555c246200ebaa1176ddf567509d1a15ccf9134c/68747470733a2f2f706f7365722e707567782e6f72672f646176696476616e6465727475696a6e2f6e756d6265725f666f726d61745f707265636973696f6e2f762f737461626c652e737667)](https://packagist.org/packages/davidvandertuijn/number_format_currency)[![License](https://camo.githubusercontent.com/00f1408d26c3343bc3b6dd8ebb54afad3b54bad927adfbd101c182a55f6571de/68747470733a2f2f706f7365722e707567782e6f72672f646176696476616e6465727475696a6e2f6e756d6265725f666f726d61745f707265636973696f6e2f6c6963656e73652e737667)](https://packagist.org/packages/davidvandertuijn/number_format_currency)

[![Number Format Precision](https://camo.githubusercontent.com/93ee3b5dd9cb492c63e96f84d73458b86924a1d3adc77f2405dc273448eff83b/68747470733a2f2f63646e2e646176696476616e6465727475696a6e2e6e6c2f6769746875622f6e756d6265725f666f726d61745f707265636973696f6e2e706e67)](https://camo.githubusercontent.com/93ee3b5dd9cb492c63e96f84d73458b86924a1d3adc77f2405dc273448eff83b/68747470733a2f2f63646e2e646176696476616e6465727475696a6e2e6e6c2f6769746875622f6e756d6265725f666f726d61745f707265636973696f6e2e706e67)

The “Number Format Precision” tool is designed to provide precise control over the formatting of numerical values in PHP, specifically addressing the need for truncating decimals without rounding. This functionality is particularly useful for developers who require exact numerical representation in financial applications, scientific calculations, or any scenario where rounding could lead to inaccuracies.

PHP built-in function **number\_format** rounds by default, this library truncates decimals without rounding.

[!["Buy Me A Coffee"](https://camo.githubusercontent.com/9f44ce2dc3b3eecdd02598900866ffc518801df1932849703dae1e5ce5031070/68747470733a2f2f7777772e6275796d6561636f666665652e636f6d2f6173736574732f696d672f637573746f6d5f696d616765732f6f72616e67655f696d672e706e67)](https://www.buymeacoffee.com/davidvandertuijn)

Install
-------

[](#install)

```
composer require davidvandertuijn/number_format_precision

```

Usage
-----

[](#usage)

Using PHP built-in function **number\_format**:

```
number_format(1234.5678, 2, '.', ''); // 1234.57
```

Using **number\_format\_precision**:

```
number_format_precision(1234.5678, 2, "int")); // 1234.56
number_format_precision(1234.5678, 2, "string")); // "1234.56"
```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance29

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity40

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

Unknown

Total

1

Last Release

1217d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6d8904bedce7fb2ec131c0d18c13aeaa82b00af2fd03ebe099886ac462b1d29e?d=identicon)[davidvandertuijn](/maintainers/davidvandertuijn)

---

Top Contributors

[![davidvandertuijn](https://avatars.githubusercontent.com/u/11010507?v=4)](https://github.com/davidvandertuijn "davidvandertuijn (2 commits)")

### Embed Badge

![Health badge](/badges/davidvandertuijn-number-format-precision/health.svg)

```
[![Health](https://phpackages.com/badges/davidvandertuijn-number-format-precision/health.svg)](https://phpackages.com/packages/davidvandertuijn-number-format-precision)
```

PHPackages © 2026

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