PHPackages                             compono-kit/money-formatters - 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. compono-kit/money-formatters

ActiveLibrary

compono-kit/money-formatters
============================

Money formatter classes for implementations of compono-kit/money-interfaces

2.0.0(7mo ago)031proprietaryPHPPHP &gt;=8.3

Since Oct 19Pushed 7mo agoCompare

[ Source](https://github.com/compono-kit/money-formatters)[ Packagist](https://packagist.org/packages/compono-kit/money-formatters)[ Docs](https://github.com/compono-kit/money-formatters)[ RSS](/packages/compono-kit-money-formatters/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (3)Versions (4)Used By (1)

Money Formatters
================

[](#money-formatters)

A lightweight PHP package providing flexible and locale-aware money string formatters.
It includes three formatter classes for different use cases — from simple decimal formatting to fully localized currency output. Uses interfaces from compono-kit/money-interfaces.

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

[](#requirements)

- PHP &gt;= 8.3
- compono-kit/money-interfaces

📦 Installation
--------------

[](#-installation)

```
composer require compono-kit/money-formatters
```

---

🚀 Overview
----------

[](#-overview)

This package defines three money formatters that implement the same interface `FormatsMoneyString`.

ClassDescriptionLocale-AwareControls Currency Symbol`SimpleMoneyFormatter`Simple decimal formatting without localization (technical format).❌✅`LocalizedDecimalMoneyFormatter`Locale-based decimal formatting using PHP’s Intl component, with manual control over the currency symbol position.✅✅`LocalizedMoneyFormatter`Fully localized currency formatting using Intl’s built-in currency rules.✅❌ (handled by locale)---

Interfaces &amp; Traits
-----------------------

[](#interfaces--traits)

Each formatter implements:

```
interface FormatsMoneyString
{
    public function formatString(RepresentsMoney $money): string;
}
```

---

Classes
-------

[](#classes)

### `SimpleMoneyFormatter`

[](#simplemoneyformatter)

Formats a `RepresentsMoney` instance as a plain decimal string without localization.
Useful for APIs or technical output where consistency matters more than human readability.

```
$formatter = new SimpleMoneyFormatter(CurrencyOutput::RIGHT_SYMBOL);

echo $formatter->formatString($money);
// Example: 1234.56 €
```

**Features**

- No locale dependency.
- No thousand separators.
- Optional control for currency presentation using enum `CurrencyOutput`:
    - `LEFT_SYMBOL` =&gt; Example: € 1234.56
    - `RIGHT_SYMBOL` =&gt; Example: 1234.56 €
    - `LEFT_ISO_CODE` =&gt; Example: EUR 1234.56
    - `RIGHT_ISO_CODE` =&gt; Example: 1234.56 EUR
    - `NONE` =&gt; Example: 1234.56

---

### `LocalizedDecimalMoneyFormatter`

[](#localizeddecimalmoneyformatter)

Formats a money value using PHP’s `\NumberFormatter` with the `DECIMAL` style.
This provides localized decimal separators, but keeps currency presentation customizable.

```
$formatter = new LocalizedDecimalMoneyFormatter('de_DE', CurrencyOutput::LEFT_SYMBOL);

echo $formatter->formatString($money);
// Example (German locale, left symbol): € 1.234,56
```

**Features**

- Locale-dependent decimal separators.
- Ideal when you want localized numbers but still want control over currency display.
- Optional control for currency presentation using enum `CurrencyOutput`:
    - `LEFT_SYMBOL` =&gt; Example: € 1.234,56
    - `RIGHT_SYMBOL` =&gt; Example: 1.234,56 €
    - `LEFT_ISO_CODE` =&gt; Example: EUR 1.234,56
    - `RIGHT_ISO_CODE` =&gt; Example: 1.234,56 EUR
    - `NONE` =&gt; Example: 1.234,56

---

### `LocalizedMoneyFormatter`

[](#localizedmoneyformatter)

Uses PHP’s `\NumberFormatter::CURRENCY` to produce **fully localized** money strings.
This is the most “natural” presentation for end users.

```
$formatter = new LocalizedMoneyFormatter('en_US');

echo $formatter->formatString($money);
// Example: $1,234.56
```

**Features**

- Fully localized formatting.
- Locale determines symbol, placement, and spacing automatically.
- Best suited for UI display and end-user presentation.

---

⚙️ CurrencyOutput Options
-------------------------

[](#️-currencyoutput-options)

`CurrencyOutput` defines how the currency symbol is positioned:

```
CurrencyOutput::LEFT_SYMBOL // e.g. € 1.234,56
CurrencyOutput::RIGHT_SYMBOL // e.g. 1.234,56 €
CurrencyOutput::LEFT_ISO_CODE  // e.g. EUR 1.234,56
CurrencyOutput::RIGHT_ISO_CODE   // e.g.  1.234,56 EUR
CurrencyOutput::NONE   // e.g. 1.234,56
```

🢙 Summary
---------

[](#-summary)

This package is designed to be **small, predictable, and composable** —
you decide how much localization you want, while keeping all formatters interchangeable via the same interface

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance65

Regular maintenance activity

Popularity3

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity52

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

2

Last Release

211d ago

Major Versions

1.0.0 → 2.0.02025-10-19

PHP version history (2 changes)1.0.0PHP &gt;=8.0

2.0.0PHP &gt;=8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/8b4875ebadf24ddeae09bd59c44c9a86a61c3d3892fe1d4a264ad167b6d230cc?d=identicon)[Hansel23](/maintainers/Hansel23)

---

Top Contributors

[![Hansel23](https://avatars.githubusercontent.com/u/15147826?v=4)](https://github.com/Hansel23 "Hansel23 (6 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/compono-kit-money-formatters/health.svg)

```
[![Health](https://phpackages.com/badges/compono-kit-money-formatters/health.svg)](https://phpackages.com/packages/compono-kit-money-formatters)
```

PHPackages © 2026

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