PHPackages                             eoneopay/currencies - 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. eoneopay/currencies

Abandoned → [eonx-com/currencies](/?search=eonx-com%2Fcurrencies)Library[Utility &amp; Helpers](/categories/utility)

eoneopay/currencies
===================

ISO 4217 compatible library for handling currencies

v1.0.0(7y ago)0356[2 PRs](https://github.com/loyaltycorp/currencies/pulls)BSD-3-ClausePHPPHP &gt;=7.1CI failing

Since Nov 29Pushed 6y ago5 watchersCompare

[ Source](https://github.com/loyaltycorp/currencies)[ Packagist](https://packagist.org/packages/eoneopay/currencies)[ RSS](/packages/eoneopay-currencies/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (7)Versions (3)Used By (0)

Currencies
==========

[](#currencies)

This library allows currencies to be found by [ISO4217](https://en.wikipedia.org/wiki/ISO_4217) code or numeric identifier and formatted for display based on different locales.

This library comes in three main parts: currencies, locales and a translator.

Currencies
----------

[](#currencies-1)

Currencies are simple files made up of:

PropertyDescriptionMinor unitThe number of decimal places the currency uses, e.g. 2 for Australian DollarNameThe currency name, e.g. Australian DollarNumeric codeThe ISO4217 numeric code, e.g. 036 for Australian DollarSymbolThe UTF-8 currency symbol, e.g. $The currency class name is the ISO4217 alpha code in PSR-2 format, e.g. `Aud` for Australian Dollar.

### Finding a currency

[](#finding-a-currency)

You can find a currency using the `ISO4217` class. This class provides two methods:

MethodDescription`find($code): CurrencyInterface`Find a currency by alpha\* or numeric code`getSupportedAlphaCodes(): array`Get a list of supported alpha codes\* Alpha code is case insensitive

**Note:** Not all currencies are currently supported, more currencies will be added as soon as possible, optionally you can open a pull request to add currencies you require.

### Working with a currency

[](#working-with-a-currency)

If a currency is successfully found you will recieve a currency object back with the following methods:

MethodDescription`getAlphaCode(): string`Get the alpha code for the currency`getMinorUnit(): int`Get the number of decimal places the currency uses`getName(): string`Get full name for the currency`getNumericCode(): string`Get the ISO4217 numeric code for the currency`getCurrencySymbol(): string`Get the UTF-8 symbol for the currencyLocales
-------

[](#locales)

Locales are also simple files made up of:

PropertyDescriptionIdentifierThe IETF language tag of the locale, e.g. en-AU for Australian EnglishCurrency formatHow to format a currency using symbol replacement, e.g. '-¤ #' for Australian EnglishDecimal separatorHow decimals are represented in numeric displays, e.g. period for Australian EnglishNegative symbolThe negative symbol used by this locale, e.g. hyphen for Austrlaian EnglishNumeric formatHow to format a numeric value using symbol replacement, e.g. '-#' for Australian EnglishThousands separatorThe separator used to group thousands together, e.g. comma for Australian English### Why not php-intl?

[](#why-not-php-intl)

This code seems to duplicate what php-intl provides with the [NumberFormatter class](http://php.net/manual/en/class.numberformatter.php) however this extension works differently on different operating systems and locales which causes formatted numbers and currencies to be inconsistent. The [symfony/intl](http://symfony.com/doc/current/components/intl.html) package only provides support for en-US or falls back to `php-intl` if it's installed which causes the same issues.

This library provides consistenty across all operating systems independently of `php-intl` when it comes to formatting numbers or currencies for display.

### Finding a locale

[](#finding-a-locale)

You can find a currency using the `Translator` class. This class provides two methods:

MethodDescription`find($code): LocaleInterface`Find a locale by IETF language code\*`getSupportedLocales(): array`Get a list of supported IETF language codes\* IETF is case insensitive and ignores special characters: en-au, en\_AU, enAu and en((au will all resolve correctly

**Note:** Not all locales are currently supported, more locales will be added as soon as possible, optionally you can open a pull request to add locales you require.

### Working with a locale

[](#working-with-a-locale)

If a locale is successfully found you will recieve a locale object back with the following method:

MethodDescription`getIdentifier(): string`Get the IETF language code for the current localeFormatting
----------

[](#formatting)

The real use of this class is to format numbers and currencies based on locale, this is done via for `Formatter` class which provides four methods:

MethodDescription`currency(string $locale): string`Get the amount formatted using the precision and symbol from the currency displayed based on an IETF locale language code`decimal(): string`Get the amount formatted using the precision from the currency, e.g. 2 decimal places for Australian Dollar`numeric(string $locale): string`Get the amount formatted using the precision from the currency displayed based on an IETF locale language codeWhen instantiating the formatter an amount and ISO4217 alpha or numeric code must be passed to the constructor.

```
/**
 * Format a currency based on locale
 */

// Create formatter based on bitcoin with negative value
$formatter = new \EoneoPay\Currencies\Formatter('-1.051', 'xbt');

// Australia
echo $formatter->currency('en-AU'); // -฿1,601.05100000

// China
echo $formatter->currency('zh-CN'); // -฿ 1601.05100000

// France
echo $formatter->currency('fr-FR'); // -1 601,05100000 ฿

// Netherlands
echo $formatter->currency('nl-NL'); // ฿ -1.601,05100000

// Oman
echo $formatter->currency('ar-OM'); // ؜฿ ؜-١٬٦٠١٫٠٥١٠٠٠٠٠

```

```
/**
 * Format a number based on locale
 */

// Create formatter based on bitcoin with positive value
$formatter = new \EoneoPay\Currencies\Formatter('1.051', 'xbt');

// Australia
echo $formatter->numeric('en-AU'); // 1,601.05100000

// China
echo $formatter->numeric('zh-CN'); // 1601.05100000

// France
echo $formatter->numeric('fr-FR'); // 1 601,05100000

// Netherlands
echo $formatter->numeric('nl-NL'); // 1.601,05100000

// Oman
echo $formatter->numeric('ar-OM'); // ؜١٬٦٠١٫٠٥١٠٠٠٠٠

```

**Note:** Arabic may not be displayed correctly due to RTL formatting of the output.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

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

Unknown

Total

1

Last Release

2721d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c6a35b20deec24986ee5baf0b9597829cb7fddc6f27188fd41fef91864877022?d=identicon)[eonx](/maintainers/eonx)

---

Top Contributors

[![merk](https://avatars.githubusercontent.com/u/278097?v=4)](https://github.com/merk "merk (5 commits)")[![sjdaws](https://avatars.githubusercontent.com/u/659316?v=4)](https://github.com/sjdaws "sjdaws (2 commits)")

---

Tags

libraryformattercurrencieseoneopay

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/eoneopay-currencies/health.svg)

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

###  Alternatives

[rinvex/countries

Rinvex Countries is a simple and lightweight package for retrieving country details with flexibility. A whole bunch of data including name, demonym, capital, iso codes, dialling codes, geo data, currencies, flags, emoji, and other attributes for all 250 countries worldwide at your fingertips.

1.7k7.4M48](/packages/rinvex-countries)[pragmarx/countries

PHP Countries and Currencies

1.9k3.3M18](/packages/pragmarx-countries)[payum/iso4217

ISO 4217 PHP Library

16312.1M5](/packages/payum-iso4217)[pragmarx/countries-laravel

Countries for Laravel

1471.1M2](/packages/pragmarx-countries-laravel)[cartalyst/converter

A framework agnostic measurement conversion and formatting package featuring multiple types of measurements and currency conversion.

88434.4k7](/packages/cartalyst-converter)[kartik-v/php-date-formatter

A Javascript datetime formatting and manipulation library using PHP date-time formats.

461.5M3](/packages/kartik-v-php-date-formatter)

PHPackages © 2026

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