1. Go to this page and download the library: Download andromedalab/fixerio library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
andromedalab / fixerio example snippets
use Fadion\Fixerio\Exchange;
use Fadion\Fixerio\Currency;
$exchange = new Exchange();
$exchange->key("YOUR_ACCESS_KEY");
$exchange->base(Currency::USD);
$exchange->symbols(Currency::EUR, Currency::GBP);
$rates = $exchange->get();
$rates = (new Exchange())->key("YOUR_ACCESS_KEY")->get();
$rates = (new Exchange())->key("YOUR_ACCESS_KEY")->symbols(Currency::USD, Currency::GBP)->get();
array('GBP' => 0.7009, 'USD' => 1.0666)
print $rates['EUR'];
print $rates[Currency::GBP];
$rates = (new Exchange())->key("YOUR_ACCESS_KEY")->symbols(Currency::USD, Currency::GBP)->getAsObject();
print $rates->USD;
print $rates->GBP;
$result = (new Exchange())->key("YOUR_ACCESS_KEY")->symbols(Currency::USD, Currency::GBP)->getResult();
$date = $result->getDate(); // The date the data is from
$rates = $result->getRates(); // Array of rates as above
$usd = $result->getRate(Currency::USD); // Will return null if there was no value
use Fadion\Fixerio\Exchange;
use Fadion\Fixerio\Exceptions\ConnectionException;
use Fadion\Fixerio\Exceptions\ResponseException;
try {
$exchange = new Exchange();
$exchange->key("YOUR_ACCESS_KEY");
$rates = $exchange->get();
}
catch (ConnectionException $e) {
// handle
}
catch (ResponseException $e) {
// handle
}
use Exchange;
use Fadion\Fixerio\Currency;
$rates = Exchange::base(Currency::USD)->get();
'fixer'=>[
'key'=>env("FIXER_ACCESS_KEY"),
]
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.