PHPackages                             php-decimal/ext-decimal - 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. php-decimal/ext-decimal

ActivePhp-ext[Utility &amp; Helpers](/categories/utility)

php-decimal/ext-decimal
=======================

Correctly-rounded, arbitrary precision decimal floating-point arithmetic in PHP

3453521[26 issues](https://github.com/php-decimal/ext-decimal/issues)[2 PRs](https://github.com/php-decimal/ext-decimal/pulls)PHP

Since Jun 30Pushed 7mo ago14 watchersCompare

[ Source](https://github.com/php-decimal/ext-decimal)[ Packagist](https://packagist.org/packages/php-decimal/ext-decimal)[ RSS](/packages/php-decimal-ext-decimal/feed)WikiDiscussions master Synced 1mo ago

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

PHP Decimal Extension
=====================

[](#php-decimal-extension)

[![PECL](https://camo.githubusercontent.com/61be876d01ebbd3f397756e6fab04ea048dd28fa59b09ef7c68c8665c560f660/68747470733a2f2f696d672e736869656c64732e696f2f7374617469632f76313f6d6573736167653d312e342e30266c6162656c3d5045434c26636f6c6f723d626c7565267374796c653d666c6174266c6f676f3d706870)](https://pecl.php.net/package/decimal/1.3.1)[![Build Status](https://camo.githubusercontent.com/51f5627a8a65efad509d7e2ee7ec63029240498a2d873efec41d532026481fa8/68747470733a2f2f7472617669732d63692e6f72672f7068702d646563696d616c2f6578742d646563696d616c2e7376673f6272616e63683d312e33)](https://travis-ci.org/php-decimal/ext-decimal)

[![PECL](https://camo.githubusercontent.com/acb22c21adf14b9dcc9360b37312e722350b99b5ded483bf8d7de76ab51ef14c/68747470733a2f2f696d672e736869656c64732e696f2f7374617469632f76313f6d6573736167653d322e302e302d616c706861266c6162656c3d5045434c26636f6c6f723d626c7565267374796c653d666c6174266c6f676f3d706870)](https://pecl.php.net/package/decimal/2.0.0)[![Build Status](https://camo.githubusercontent.com/0c5e9f88ac277c033896ffbeeeca180d3c736bd6a51eaaee3df769fc7eb9b9e5/68747470733a2f2f7472617669732d63692e6f72672f7068702d646563696d616c2f6578742d646563696d616c2e7376673f6272616e63683d322e30267374796c653d666c6174)](https://travis-ci.org/php-decimal/ext-decimal)[![Build status](https://camo.githubusercontent.com/c8a245d3df80d5cbb48ece92157b982ec7e8e0b92f63f4c3dbca3551d8927bba/68747470733a2f2f63692e6170707665796f722e636f6d2f6170692f70726f6a656374732f7374617475732f6c67356e7735747167706d76316333333f7376673d74727565)](https://ci.appveyor.com/project/rtheunissen/php-decimal)

Correctly-rounded, arbitrary-precision decimal arithmetic for PHP

Documentation
-------------

[](#documentation)

See [php-decimal.github.io](https://php-decimal.github.io)

Requirements
------------

[](#requirements)

- PHP &gt;= 7.2
- [libmpdec &gt;= 2.4](http://www.bytereef.org/mpdecimal/download.html)

### Installing libmpdec header files

[](#installing-libmpdec-header-files)

For Fedora:

```
sudo dnf install mpdecimal-devel
```

Install
-------

[](#install)

```
pecl install decimal

```

**Alpha**:

```
pecl install decimal-alpha

```

Windows users can find *.dll* files under [releases](https://github.com/php-decimal/ext-decimal/releases).

Enable
------

[](#enable)

You can do this temporarily using `php -dextension=decimal.so` or by adding `extension=decimal.so` to your INI. If you manage PHP with [phpbrew](https://github.com/phpbrew/phpbrew), you can use `phpbrew ext enable decimal`.

Tests
-----

[](#tests)

```
php run-tests.php -P -q

```

Build from source
-----------------

[](#build-from-source)

Build a debug build of `php-src` with a prefix as follows:

```
./configure --disable-all --enable-debug --prefix /path/to/custom-php/
```

Within the folder of this extension first run `phpize` and then

```
./configure --with-php-config=/path/to/custom-php/bin/php-config CFLAGS="-Wfatal-errors -Wall -Wpedantic -Wextra -Wno-unused-parameter -Werror"
```

And finally:

```
make -jN
```

Where `N` is the number of cores available for compilation

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance42

Moderate activity, may be stable

Popularity29

Limited adoption so far

Community24

Small or concentrated contributor base

Maturity14

Early-stage or recently created project

 Bus Factor1

Top contributor holds 82.6% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/761df764fa80c32031884a5dd2376cf7e70c0fa152eaa141fd68f12b4a761b9f?d=identicon)[rtheunissen](/maintainers/rtheunissen)

---

Top Contributors

[![rtheunissen](https://avatars.githubusercontent.com/u/809191?v=4)](https://github.com/rtheunissen "rtheunissen (147 commits)")[![remicollet](https://avatars.githubusercontent.com/u/270445?v=4)](https://github.com/remicollet "remicollet (14 commits)")[![krakjoe](https://avatars.githubusercontent.com/u/2236138?v=4)](https://github.com/krakjoe "krakjoe (6 commits)")[![weltling](https://avatars.githubusercontent.com/u/22016?v=4)](https://github.com/weltling "weltling (4 commits)")[![cmb69](https://avatars.githubusercontent.com/u/2306138?v=4)](https://github.com/cmb69 "cmb69 (2 commits)")[![Jan-E](https://avatars.githubusercontent.com/u/1757825?v=4)](https://github.com/Jan-E "Jan-E (1 commits)")[![bobvandevijver](https://avatars.githubusercontent.com/u/1835343?v=4)](https://github.com/bobvandevijver "bobvandevijver (1 commits)")[![flexboom](https://avatars.githubusercontent.com/u/100702088?v=4)](https://github.com/flexboom "flexboom (1 commits)")[![Girgias](https://avatars.githubusercontent.com/u/7906688?v=4)](https://github.com/Girgias "Girgias (1 commits)")[![asgrim](https://avatars.githubusercontent.com/u/496145?v=4)](https://github.com/asgrim "asgrim (1 commits)")

---

Tags

arbitrary-precisiondecimalphp

### Embed Badge

![Health badge](/badges/php-decimal-ext-decimal/health.svg)

```
[![Health](https://phpackages.com/badges/php-decimal-ext-decimal/health.svg)](https://phpackages.com/packages/php-decimal-ext-decimal)
```

###  Alternatives

[gitonomy/gitlib

Library for accessing git

46418.6M56](/packages/gitonomy-gitlib)

PHPackages © 2026

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