PHP Classes

File: README.md

Recommend this page to a friend!
  Classes of Ogbemudia Osayawe  >  PHP Get Currency Symbol  >  README.md  >  Download  
File: README.md
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: PHP Get Currency Symbol
Get the symbol of any given currency
Author: By
Last change:
Date: 2 years ago
Size: 783 bytes
 

Contents

Class file image Download

php currency-util

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.

For more information send a message to info at phpclasses dot org.