terdia/currency-util

A simple library to lookup the currency symbol for a given currency code.

Installs: 101 587

Dependents: 0

Suggesters: 0

Security: 0

Stars: 9

Watchers: 1

Forks: 1

Open Issues: 1

pkg:composer/terdia/currency-util

v1.0.1 2022-03-20 15:55 UTC

This package is auto-updated.

Last update: 2025-09-20 23:54:22 UTC


README

A simple library to lookup the currency symbol for a given currency code.

Installation

composer req terdia/currency-util

Usage

Get symbol from currency code

use Currency\Util\CurrencySymbolUtil;

CurrencySymbolUtil::getSymbol('GBP') //=> '£'
CurrencySymbolUtil::getSymbol('EUR') //=> '€'
CurrencySymbolUtil::getSymbol('USD') //=> '$'
CurrencySymbolUtil::getSymbol('NOT A VALID CODE') throw InvalidArgumentException

Get List of supported currency code

use Currency\Util\CurrencySymbolMapping;

var_dump(CurrencySymbolMapping::values())
// =>
[
 "USD" => "$",
 "GBP" => "£",
 "EUR" => "",
 …
]

Tests

vendor/bin/phpunit tests

Contribution

Feel free to contribute to this library.