Currency Conversion for ProcessWire

It provides various API functions that you can use to convert from onecurrency to another. This is especially handy for generating rate tables
in multiple currencies or giving users of your site the option to see
prices in their currency.

How to install

Copy the files here into /site/modules/ServiceCurrencyConversion/

In your ProcessWire admin, check for new modules and click install for this module.

Obtain an OpenExchangeRates.org API key. Because this module caches the exchange rate datafor a period that you specify, you may find the free account to be adequate unless you need
up-to-the-minute exchange rate data.

Paste your key into the module configuration screen where prompted to do so.After saving, you should see a table indicating current exchange rate data.

How to use

Usage is best demonstrated by example. Here is a basic example thatdemonstrates conversion of a rate from USD (US Dollars) to EUR (Euros). The
context for these examples is from one of your site template files.

USD and EUR can be any currency codes known by OpenExchangeRates.org, meaningyou should be able to convert between any two currencies that you want to.

For a live example of a currency conversion tool, try out the included convert.phpfile included with this module. Copy it to your /site/templates/, add it as a new
template, and create a page with it.

API

The following methods are provided by the Service Exchange Rates module.All of the example calls below assume you have a copy of the ServiceCurrencyConversion
module in the variable $ex, obtained by a call like this:

$cc = $modules->get('ServiceCurrencyConversion');

$cc->convert($fromCurrency, $toCurrency, $amount)

Convert an amount from one currency to another and return the converted amount.For $fromCurrency and $toCurrency, specify the 3-digit currency code.

// how many dollars are there in 100 euros?
echo $cc->convert('EUR', 'USD', 100); // outputs 136.335 (when I tested)