Skip to content

Latest commit

 

History

History
24 lines (14 loc) · 1.1 KB

File metadata and controls

24 lines (14 loc) · 1.1 KB

Readme

This class will allow you to convert currencies and also calculate how much you need in a specific currency to achieve a final amount in another currency.

The class supports caching. The files will be cached daily.

Usage

Call the class. There are three optional parameters:

$cache - Set this to FALSE if you do not want to enabled cachine (TRUE by default)
$cacheFolder - Set your cache folder. By default, it is /classes/convert
$cacheTimeout - Set the amount of time the rates are cached for (in seconds), set to 1 day by default

Sample usage in usage.php

Methods

convert() - Four parameters, $amount, $fromCurrency and $toCurrency and $round. Set $round to FALSE to disable rounding. TRUE by default.
amountTo() - Four parameters, $finalAmount, $fromCurrency, $toCurrency and $round. This will show you how much $fromCurrency you need to get $finalAmoun in $toCurrency. Set $round to FALSE to disable rounding. TRUE by default.
getRate() - Two parameters, $fromCurrency and $toCurrency. Returns the rate.
clearCache() - Deletes all cache files