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

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

amberovsky/currency
===================

ISO-4217 Currency implementation

v0.3.2(5y ago)0211BSD-3-ClausePHPPHP ^7.4CI failing

Since Jul 5Pushed 5y ago1 watchersCompare

[ Source](https://github.com/amberovsky/currency)[ Packagist](https://packagist.org/packages/amberovsky/currency)[ RSS](/packages/amberovsky-currency/feed)WikiDiscussions master Synced 6d ago

READMEChangelog (7)Dependencies (4)Versions (13)Used By (1)

Currency
========

[](#currency)

A simple [ISO-4217](https://en.wikipedia.org/wiki/ISO_4217) comprehensive Currency class with PSR-16 caching

### How to use

[](#how-to-use)

Please provision `Currency\Factory` with any PSR-16 implementation (for example, [Symfony cache](https://symfony.com/doc/current/components/cache.html))

#### Symfony

[](#symfony)

Add this to the `config\services.yaml`:

```
    # Adapter from Symfony PSR-16 to PSR-6
    amberovsky.money.currency.currencyFactory.cacheAdapter:
        class: Symfony\Component\Cache\Psr16Cache
        arguments:
            - '@cache.app'

    Amberovsky\Money\Currency\ISO4217:
    Amberovsky\Money\Currency\CurrencyFactory:
        public: true
        arguments:
            $ISO4217: '@Amberovsky\Money\Currency\ISO4217'
            $cache: '@amberovsky.money.currency.currencyFactory.cacheAdapter'
```

#### Examples

[](#examples)

```
use Amberovsky\Money\Currency\CurrencyFactory;
use Amberovsky\Money\Currency\ISO4217;

$factory = new CurrencyFactory(new ISO4217(), new PSR16Cache());

$usd = $factory->fromNumericCode(ISO4217::NUMERIC_USD);

// or

$usd = $factory->fromAlphaCode(ISO4217::ALPHA_USD);

// then

$usd->getNumericCode(); // 809
$usd->getDescription(); // US Dollar
$usd->getMinorUnits(); // 2
$usd->getAlphaCode(); // USD
$usd->getSymbol(); // $

// also, these methods could be useful
ISO4217::toNumericCode(string $alphaCode): int
ISO4217::toAlphaCode(int $numericCode): string
```

### Integration with Doctrine

[](#integration-with-doctrine)

Please use [amberovsky/currency-doctrine](https://github.com/amberovsky/currency-doctrine) if you need doctrine integration. It provides doctrine mapping type for `Currency`

### How to contribute

[](#how-to-contribute)

Please fork this repo and create a PR. Make sure you run tests before submitting yout PR:

```
make phpstan
make psalm
make phpspec
```

### License

[](#license)

Copyright (C) 2020 Anton Zagorskii, BSD-3-Clause license, See [license file](/LICENSE.txt) for details

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community9

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

Total

7

Last Release

2127d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/477339?v=4)[amberovsky](/maintainers/amberovsky)[@amberovsky](https://github.com/amberovsky)

---

Top Contributors

[![amberovsky](https://avatars.githubusercontent.com/u/477339?v=4)](https://github.com/amberovsky "amberovsky (7 commits)")

###  Code Quality

Static AnalysisPHPStan, Psalm

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[mobiledetect/mobiledetectlib

Mobile\_Detect is a lightweight PHP class for detecting mobile devices. It uses the User-Agent string combined with specific HTTP headers to detect the mobile environment.

10.7k159.4M431](/packages/mobiledetect-mobiledetectlib)[illuminate/contracts

The Illuminate Contracts package.

704122.9M10.1k](/packages/illuminate-contracts)[phiki/phiki

Syntax highlighting using TextMate grammars in PHP.

3573.0M23](/packages/phiki-phiki)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

728272.9k20](/packages/civicrm-civicrm-core)[flow-php/etl

PHP ETL - Extract Transform Load - Abstraction

374468.4k51](/packages/flow-php-etl)[gehrisandro/tailwind-merge-php

TailwindMerge for PHP merges multiple Tailwind CSS classes by automatically resolving conflicts between them

1391.5M9](/packages/gehrisandro-tailwind-merge-php)

PHPackages © 2026

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