Light weight library to convert currencies with offset
Install currencylib with composer
composer require blvckgvd/currencylib
use Blvckgvd\Currencylib\CurrencyLib;
public function convertPrice() {
$price = CurrencyLib::convert('USD', 'EUR', 350, 2);
return $price;
}
// Converted from US Dollars to Euros number
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 €
use Blvckgvd\Currencylib\CurrencyLib;
public function getSymbol() {
$symbol = CurrencyLib::getCurrencySymbol('JPY');
return $symbol;
}
// Get symbol from currency code, at this situation you'll get ¥
- 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