PHPackages                             thunderer/currenz - 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. thunderer/currenz

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

thunderer/currenz
=================

ISO4217 currency library

v0.1.0(8y ago)19MITPHPPHP ^7.0

Since Sep 30Pushed 8y ago1 watchersCompare

[ Source](https://github.com/thunderer/Currenz)[ Packagist](https://packagist.org/packages/thunderer/currenz)[ RSS](/packages/thunderer-currenz/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

Currenz
=======

[](#currenz)

[![Build Status](https://camo.githubusercontent.com/c6ee6f3d54a6ddae9f763210c1a4c55e19a111d9f94be7d83960d8048db4bcfe/68747470733a2f2f7472617669732d63692e6f72672f7468756e64657265722f43757272656e7a2e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/thunderer/Currenz)[![SensioLabsInsight](https://camo.githubusercontent.com/ee0e56a18be0ddabcca0f8812829354e8598510e5629935d8e0cbc7775c81e1a/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f35663636646533382d613063642d346561372d383433322d3036363936336238623238372f6d696e692e706e67)](https://insight.sensiolabs.com/projects/5f66de38-a0cd-4ea7-8432-066963b8b287)[![License](https://camo.githubusercontent.com/78a60fa20bf7d5bfcbf68163220f2047520f8ccbc31edd1246a36f02af6d8b62/68747470733a2f2f706f7365722e707567782e6f72672f7468756e64657265722f63757272656e7a2f6c6963656e73652e737667)](https://packagist.org/packages/thunderer/currenz)[![Latest Stable Version](https://camo.githubusercontent.com/1d9a746c83de64d8c66944f9e0d92da7c4c6c28f056d880ddd6d59a67dc6a531/68747470733a2f2f706f7365722e707567782e6f72672f7468756e64657265722f63757272656e7a2f762f737461626c652e737667)](https://packagist.org/packages/thunderer/currenz)[![Total Downloads](https://camo.githubusercontent.com/3bad6f23bcf179cf662543968322cffc5925a6fe209f122628a30a1d6685e163/68747470733a2f2f706f7365722e707567782e6f72672f7468756e64657265722f63757272656e7a2f646f776e6c6f616473)](https://packagist.org/packages/thunderer/currenz)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/b5b3ba6b8cecc1497deeb2183dd66b630218fe110e6c153b75d7c3a01afb15e4/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7468756e64657265722f43757272656e7a2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/thunderer/Currenz/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/1fbec1781ccd1b42ffa7d621df0d7eaf9702e34a0b00893c5785f106a54fac79/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7468756e64657265722f43757272656e7a2f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/thunderer/Currenz/?branch=master)

Currenz is a small and easy to use utility library providing currency value objects for all currencies defined in [ISO4217:2015](https://www.iso.org/iso-4217-currency-codes.html). You can read more about the standard on [Wikipedia](https://en.wikipedia.org/wiki/ISO_4217).

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

[](#installation)

This library is [available on Packagist](https://packagist.org/packages/thunderer/currenz) as `thunderer/currenz`. It can be installed using Composer by executing following command in the project directory:

```
composer require thunderer/currenz=^0.1

```

Usage
-----

[](#usage)

Every currency has its own dedicated class and implements a common interface. There are multiple ways of creating an instance of given currency class using its three-letter code:

```
use Thunder\Currenz\Currency\PLN;
use Thunder\Currenz\Currency\USD;

$usd = new USD();
$usd = Currenz::USD();
$usd = Currenz::createFromCode('USD');

$pln = new PLN();
$pln = Currenz::PLN();
$pln = Currenz::createFromCode('PLN');
```

Following methods can be called to extract desired information from currency object:

```
assert('PLN' === $pln->getCode()); // ISO4217 currency code
assert('Zloty' === $pln->getName()); // regular name
assert(2 === $pln->getDigits()); // number of decimal places
assert(100 === $pln->getUnits()); // number of base units
assert(['POLAND'] === $pln->getCountries()); // list of countries where it is used
assert('985' === $pln->getNumber()); // ISO4217 currency number
```

Binaries
--------

[](#binaries)

There are two executable scripts included in the code of this library:

- `bin/generate` generates `Currenz` class from data in `data/list_one.xml`. It should be used in Composer's `post-install` and `post-update` hooks,
- `bin/summary` shows all information from that file in an easy to read tabular view.

Notes
-----

[](#notes)

### ISO4217 data files

[](#iso4217-data-files)

Following ISO4217 data files downloaded from the standard's website are included in `data` directory in this repository:

- `list_one.xml`: list of currencies in active usage, this file is used to generate all classes in `bin/generate` script,
- `list_one.xls`: the same data in XLS format,
- `list_two.doc`: information about maintenance agency registered fund codes in DOC format,
- `list_three.xml`: list of historical currencies removed from the current version of the standard,
- `list_three.xls`: the same data in XLS format,
- `overview_amendments.xlsx`: list of standard's amendments,
- `schema.xsd`: standard's XSD schema for included XML files.

### Non-decimal currencies

[](#non-decimal-currencies)

There are currencies called `non-decimal`, which means that their [base units are not powers of 10](https://en.wikipedia.org/wiki/Non-decimal_currency). Their value is so low that they are usually omitted. Currently there are two of them:

- Mauritania 1 ouguiya (UM) = 5 khoums,
- Madagascar 1 ariary = 5 iraimbilanja.

This library strictly follows ISO4217 standard so both of them will appear as currencies with 100 base units (10^2).

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

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

Unknown

Total

1

Last Release

3149d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/680192ceb7e1e044f31aec779ef8220d062d819d476338a0c9cf5792cf8f424e?d=identicon)[Thunderer](/maintainers/Thunderer)

---

Top Contributors

[![thunderer](https://avatars.githubusercontent.com/u/1087180?v=4)](https://github.com/thunderer "thunderer (1 commits)")

---

Tags

currencygenerated-codeiso4217phpcurrencycodelibraryiso4217

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/thunderer-currenz/health.svg)

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

###  Alternatives

[endroid/qr-code

Endroid QR Code

4.8k67.6M348](/packages/endroid-qr-code)[laminas/laminas-code

Extensions to the PHP Reflection API, static code scanning, and code generation

1.9k185.4M172](/packages/laminas-laminas-code)[nette/php-generator

🐘 Nette PHP Generator: generates neat PHP code for you. Supports new PHP 8.5 features.

2.2k64.2M576](/packages/nette-php-generator)[brick/money

Money and currency library

1.9k37.9M102](/packages/brick-money)[jetbrains/phpstorm-stubs

PHP runtime &amp; extensions header files for PhpStorm

1.4k27.7M68](/packages/jetbrains-phpstorm-stubs)[scrivo/highlight.php

Server side syntax highlighter that supports 185 languages. It's a PHP port of highlight.js

71040.3M82](/packages/scrivo-highlightphp)

PHPackages © 2026

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