Skip to content

BLVCKGVD/currencylib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

currencylib

Light weight library to convert currencies with offset

PHP Composer

MIT License

PHP

ext-simplexml

Made By

Installation

Install currencylib with composer

  composer require blvckgvd/currencylib

Usage/Examples

Just Convert

use Blvckgvd\Currencylib\CurrencyLib;

public function convertPrice() {
  $price = CurrencyLib::convert('USD', 'EUR', 350, 2);
  return $price;
}
// Converted from US Dollars to Euros number

Convert with currency symbol

use Blvckgvd\Currencylib\CurrencyLib;

public function convertPriceWithSymbol() {
  $price = CurrencyLib::convertWithCurrencySymbol('USD', 'EUR', 350, 2);
  return $price;
}
// Converted from US Dollars to Euros number with symbol €

Get Currency symbol

use Blvckgvd\Currencylib\CurrencyLib;

public function getSymbol() {
  $symbol = CurrencyLib::getCurrencySymbol('JPY');
  return $symbol;
}
// Get symbol from currency code, at this situation you'll get ¥

Supported currency codes

  • AUD
  • AZN
  • GBP
  • AMD
  • BYN
  • BGN
  • BRL
  • HUF
  • VND
  • HKD
  • GEL
  • DKK
  • AED
  • USD
  • EUR
  • EGP
  • INR
  • IDR
  • KZT
  • CAD
  • QAR
  • KGS
  • CNY
  • MDL
  • NZD
  • NOK
  • PLN
  • RON
  • XDR
  • SGD
  • TJS
  • THB
  • TRY
  • TMT
  • UZS
  • UAH
  • CZK
  • SEK
  • CHF
  • RUB
  • RSD
  • ZAR
  • KRW
  • JPY