PHPackages                             vinaikopp/currency-info - 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. vinaikopp/currency-info

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

vinaikopp/currency-info
=======================

Provide basic information to display a currency amount

2.0.1(9y ago)017BSD-3-ClausePHPPHP ~5.6.0|~7.0.0

Since May 30Pushed 9y ago2 watchersCompare

[ Source](https://github.com/Vinai/currency-info)[ Packagist](https://packagist.org/packages/vinaikopp/currency-info)[ RSS](/packages/vinaikopp-currency-info/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (4)Used By (0)

Currency Info
=============

[](#currency-info)

This repository offers an easy way to get data required to display money values in a given currency:

- Fraction Digits (e.g. 2 for currencies with 100 subunits like USD)
- Rounding (e.g. 0.05 for currencies like CHF)
- International Symbol (e.g. € for EUR)
- Native Symbol (e.g. $ for USD)

To look up the information the (ISO 4217) three letter currency code, e.g. DKK or EUR).

Background
----------

[](#background)

Sometimes a currency package that provides all things about currency is overkill. I might just want to render a monetary value.
PHP can natively nicely format currency values, but it doesn't know about the default fraction digits for example.
This is what this package can be used for. It does not provide any functionality in regards to conversion or division or such.
All this package does is provide information about a given currency.

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

[](#installation)

Install using composer:

```
$ composer require vinaikopp/currency-info "^2.0.0"

```

Or add it manually to the composer.json file:

```
{
    "require": {
        "vinaikopp/currency-info": "^2.0.0"
    }
}
```

Usage
-----

[](#usage)

For example, to display a money value with the default number of fraction digits, something like this could be used:

**Example using static methods**

```
use VinaiKopp\CurrencyInfo\StaticAccess\CurrencyInfo;

$currency = 'EUR';
$locale = 'de_DE';
$formatter = new \NumberFormatter($locale, \NumberFormatter::CURRENCY);
$decimalPlaces = CurrencyInfo::getFractionDigitsForCurrency($currency);
$formatter->setAttribute(\NumberFormatter::FRACTION_DIGITS, $decimalPlaces);

echo $formatter->formatCurrency($value, $currency);
```

If you use an Dependency Injection Container and would like an instance you can inject, you can use `\VinaiKopp\CurrencyInfo\CurrencyInfo`.

**Example using a currency info instance**

```
public function __construct(\VinaiKopp\CurrencyInfo\CurrencyInfo $currencyInfo)
{
    $this->currencyInfo = $currencyInfo;
    $this->currency = 'USD';
    $this->locale = 'en_US'
}

public function format($amount)
{
    $formatter = new \NumberFormatter($this->locale, \NumberFormatter::CURRENCY);
    $decimalPlaces = $this->currencyInfo->getFractionDigitsForCurrency($this->currency);
    $formatter->setAttribute(\NumberFormatter::FRACTION_DIGITS, $decimalPlaces);

    return $formatter->formatCurrency($amount, $this->currency);
}
```

What it is not
--------------

[](#what-it-is-not)

This package does not offer capabilities to do money calculations or currency conversions. If you need that, I suggest using [mathiasverraes/money](https://github.com/moneyphp/money).

Continuous Integration
======================

[](#continuous-integration)

ServiceBuild StatusCoverageScoreTravis[![Build Status](https://camo.githubusercontent.com/83b7dbeb365802c082f1ea21b059ced27dfc7a44bf56aee92c4116fecae50591/68747470733a2f2f7472617669732d63692e6f72672f56696e61692f63757272656e63792d696e666f2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Vinai/currency-info)Scrutinizer[![Build Status](https://camo.githubusercontent.com/fb1cb038d49817e7a42bd25447aec3e5ea13ae4d122b8418e65b0153e2ca89ce/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f56696e61692f63757272656e63792d696e666f2f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Vinai/currency-info/?branch=master)[![Coverage](https://camo.githubusercontent.com/dd95125805bce9ac8f4d1e00925eecb272f6d6f1281220dbea5d8af8f814d014/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f56696e61692f63757272656e63792d696e666f2f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Vinai/currency-info/?branch=master)[![Quality Score](https://camo.githubusercontent.com/065433595e914ad81f82837812fffa27b678c46b2903d51fb981e7de272f8d70/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f56696e61692f63757272656e63792d696e666f2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Vinai/currency-info/?branch=master)Where does the data come from?
------------------------------

[](#where-does-the-data-come-from)

The map is based on the [LocalePlanet Currency Map](http://www.localeplanet.com/api/auto/currencymap.html).
Thanks for their epic efforts!!

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity60

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

Total

3

Last Release

3632d ago

Major Versions

1.0.0 → 2.0.02016-05-31

### Community

Maintainers

![](https://www.gravatar.com/avatar/1905417db5fbd31a61553b29bd441fdc66945da7cfb14f1b20a72275c68184e8?d=identicon)[vinai](/maintainers/vinai)

---

Top Contributors

[![Vinai](https://avatars.githubusercontent.com/u/72463?v=4)](https://github.com/Vinai "Vinai (24 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/vinaikopp-currency-info/health.svg)

```
[![Health](https://phpackages.com/badges/vinaikopp-currency-info/health.svg)](https://phpackages.com/packages/vinaikopp-currency-info)
```

###  Alternatives

[barryvdh/reflection-docblock

1.3k118.6M40](/packages/barryvdh-reflection-docblock)[altis/roles-to-taxonomy

WordPress plugin to store user roles and user levels in a taxonomy, for performance.

9444.9k](/packages/altis-roles-to-taxonomy)

PHPackages © 2026

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