PHPackages                             marekskopal/orm-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. [Database &amp; ORM](/categories/database)
4. /
5. marekskopal/orm-decimal

ActiveLibrary[Database &amp; ORM](/categories/database)

marekskopal/orm-decimal
=======================

Decimal type from ext-decimal PHP extension mapper for MarekSkopal ORM.

v1.1.0(2mo ago)0347—0%MITPHPPHP &gt;=8.4

Since Dec 31Pushed 2mo ago1 watchersCompare

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

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

ORM Decimal
===========

[](#orm-decimal)

[![PHP](https://camo.githubusercontent.com/3e40355d4b2264eabe393a68b0170731d7de406c68341066ff309755ab9224c2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253345253344382e342d626c7565)](https://www.php.net/)[![License](https://camo.githubusercontent.com/f8df3091bbe1149f398a5369b2c39e896766f9f6efba3477c63e9b4aa940ef14/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e)](LICENSE)

`Decimal\Decimal` type mapper for [marekskopal/orm](https://github.com/marekskopal/orm), powered by the [`ext-decimal`](https://php-decimal.io/) PHP extension. Handles precise decimal arithmetic without floating-point rounding errors — ideal for monetary values and other exact numeric data.

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

[](#requirements)

- PHP &gt;= 8.4
- [`ext-decimal`](https://php-decimal.io/) PHP extension
- [`marekskopal/orm`](https://github.com/marekskopal/orm) ^1.0

Installation
------------

[](#installation)

```
composer require marekskopal/orm-decimal
```

> The `ext-decimal` extension must be installed separately. See [php-decimal.io](https://php-decimal.io/) for installation instructions.

Usage
-----

[](#usage)

Apply the `#[ColumnDecimal]` attribute to a `Decimal` property on your ORM entity. The `precision` and `scale` parameters map directly to the SQL `DECIMAL(precision, scale)` column type.

```
use Decimal\Decimal;
use MarekSkopal\ORM\Attribute\Entity;
use MarekSkopal\ORM\Decimal\Attribute\ColumnDecimal;

#[Entity]
class Product
{
    #[ColumnDecimal(precision: 8, scale: 2)]
    public Decimal $price;

    #[ColumnDecimal(precision: 10, scale: 4, nullable: true)]
    public ?Decimal $discount;
}
```

### Parameters

[](#parameters)

ParameterTypeRequiredDescription`precision``int`yesTotal number of significant digits (must be &gt; 0)`scale``int`yesDigits after the decimal point (must be &lt; `precision`)`name``string`noOverride the database column name`nullable``bool`noAllow `null` values (default: `false`)How It Works
------------

[](#how-it-works)

- **`ColumnDecimal`** — a PHP attribute that extends the ORM's `Column` attribute with `Type::Decimal` and registers `DecimalMapper` as its value handler.
- **`DecimalMapper`** — implements `MapperInterface`, converting database strings to `Decimal\Decimal` objects on read (`mapToProperty`) and back to strings on write (`mapToColumn`).

License
-------

[](#license)

MIT — see [LICENSE](LICENSE).

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance94

Actively maintained with recent releases

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

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

Total

2

Last Release

61d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2eeb4a0e8bc7e2ce26f00193dac3973909911a18079b18956b03af66b901421a?d=identicon)[marekskopal](/maintainers/marekskopal)

---

Top Contributors

[![marekskopal](https://avatars.githubusercontent.com/u/33967656?v=4)](https://github.com/marekskopal "marekskopal (13 commits)")

---

Tags

ormdecimalext-decimal

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/marekskopal-orm-decimal/health.svg)

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

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[doctrine/doctrine-bundle

Symfony DoctrineBundle

4.8k241.3M3.3k](/packages/doctrine-doctrine-bundle)[doctrine/persistence

The Doctrine Persistence project is a set of shared interfaces and functionality that the different Doctrine object mappers share.

4.1k286.5M762](/packages/doctrine-persistence)[gedmo/doctrine-extensions

Doctrine behavioral extensions

4.1k118.8M365](/packages/gedmo-doctrine-extensions)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.3k](/packages/illuminate-database)[beberlei/doctrineextensions

A set of extensions to Doctrine 2 that add support for additional query functions available in MySQL, Oracle, PostgreSQL and SQLite.

2.1k75.1M146](/packages/beberlei-doctrineextensions)

PHPackages © 2026

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