Skip to content
simple unit-tested class to convert currencies (e.g. GBP->EUR). Reads exchange rates from the official European Central Bank's online public XML
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
library/Ec/Ecb
tests/Ec/Ecb
vendor
README.md
composer.json
phpunit.xml
sample.php

README.md

Currency converter ECB (European central bank)

XML Parser (of http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml) and currency converter (from one currency to any other).

Example

$parser = new \Ec\Ecb\Parser(file_get_contents('http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml')); //cache this object
$converter = new \Ec\Ecb\Converter($parser);
echo $converter->convert(1.5, 'EUR', 'GBP'); //convert 1.5 EUR into GBP

Usage:

  • create composer.json

    { "name": "your-project", "authors": [ { "name": "your name", "email": "your email" } ], "minimum-stability": "dev", "require": { "elvisciotti/currency-converter-ecb": "*" }, "repositories": [ { "type": "git", "url": "https://github.com/elvisciotti/currency-converter-ecb" } ] }

  • copy sample.php into your roto directory and modify

You can’t perform that action at this time.