PHP Classes
elePHPant
Icontem

PHP Get Currency Symbol: Get the symbol of any given currency

Recommend this page to a friend!
  Info   View files Documentation   View files View files (8)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2019-08-31 (20 days ago) RSS 2.0 feedNot yet rated by the usersTotal: 64 This week: 14All time: 9,497 This week: 21Up
Version License PHP version Categories
currency-util 1.0.0MIT/X Consortium ...5PHP 5, Finances
Description Author

This class can get the symbol of any given currency.

It can take as parameter of code of a given currency.

The class can return the symbol associated to that currency.

  Performance   Level  
Name: Ogbemudia Osayawe <contact>
Classes: 3 packages by
Country: Malaysia Malaysia
Age: 36
All time rank: 408017 in Malaysia Malaysia
Week rank: 4 Up1 in Malaysia Malaysia Up

 

Details

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.

  Files folder image Files  
File Role Description
Files folder imagesrc (2 files)
Files folder imagetests (1 file)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file composer.lock Data Auxiliary data
Accessible without login Plain text file LICENCE.md Lic. License text
Accessible without login Plain text file phpunit.xml Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  src  
File Role Description
  Plain text file CurrencySymbolMapping.php Class Class source
  Plain text file CurrencySymbolUtil.php Class Class source

  Files folder image Files  /  tests  
File Role Description
  Plain text file CurrencySymbolUtilTest.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:64
This week:14
All time:9,497
This week:21Up