# Currency

> Models ISO-4217 currencies as a PHP enum, with per-currency fraction digit resolution.

The Composer package `tiny-blocks/currency`, at version 2.3.6, documented at https://tiny-blocks.github.io/currency/.

Install it with `composer require tiny-blocks/currency`.

## Overview

Models [ISO-4217](https://www.iso.org/iso-4217-currency-codes.html) currencies as a PHP enum, covering all standard
currency codes with their correct number of fraction digits. Resolves edge cases such as zero-decimal currencies (JPY,
KRW), three-decimal currencies (BHD, KWD), and four-decimal currencies (CLF, UYW). Backed by a native PHP enum for
zero-overhead comparison and type safety.

## How to use

The library exposes the `Currency` enum. In addition to the alphabetic code, the matching number of fraction digits is
available for the respective currency.

```php
<?php

declare(strict_types=1);

use TinyBlocks\Currency\Currency;

$currency = Currency::USD;

$currency->name;                # USD
$currency->value;               # USD
$currency->getFractionDigits(); # 2
```
