webtorque / currency-converter
Currency converter for SilverStripe CMS
Installs: 27
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 3
Forks: 4
Open Issues: 1
Type:silverstripe-vendormodule
Requires
- php: >=5.6.40
- ext-simplexml: *
- guzzlehttp/guzzle: ~6.0
- silverstripe/framework: ^4
This package is not auto-updated.
Last update: 2024-11-19 03:13:40 UTC
README
#SilverStripe Currency Converter
Simple service for converting currencies for SilverStripe 4+
Installation
Composer
composer require webtorque/currency-converter
Usage
To convert $99.99 NZD to USD
$convertedAmount = CurrencyConverter::get_converter()->convert(99.99, 'NZD', 'USD');
Exchange rates
Default implementation uses an xml feed at http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml. Other sources and be created by inheriting from CurrencyConverter and implementing the retrieveCurrencies function.
Then change the converter
config option on CurrencyConverter e.g.
Zanderwar\CurrencyConverter\CurrencyConverter: converter: MyCurrencyConverter
Alternatively, you can pass the name of the class into get_converter e.g.
$convertedAmount = CurrencyConverter::getConverter(MyCurrencyConverter::class)->convert(9999, 'NZD', 'USD');