Skip to content

A wrapper for Google's currency conversion API. Real easy to use and a couple of neat features. Supports custom caching at a custom rate.

Notifications You must be signed in to change notification settings

Prashles2/PHP-Currency-Convert-Class

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A wrapper for Google's currency conversion API. Real easy to use and a couple of neat features. Supports custom caching at a custom rate.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages