1. Go to this page and download the library: Download nacoma/fixer-io 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/ */
nacoma / fixer-io example snippets
use Nacoma\Fixer\ExchangeFactory;
use Nacoma\Fixer\Http\Client;
use Nacoma\Fixer\Http\Middleware\ETagMiddleware;
$client = new Client(new Psr18Client(), [
new ETagMiddleware(
new SimpleCache(),
new Psr17ResponseFactory(),
new Psr17StreamFactory(),
)
]);
$exchangeFactory = new ExchangeFactory(
$client,
new Psr17RequestFactory(),
new Psr17UriFactory(),
'your-access-key',
);
$exchange = $exchangeFactory->create('USD', ['EUR', 'JPY']);
// obtaining all rates
$result = $exchange->latestRates();
// manual conversion
$converted = 50 * $result->rates['EUR'];
// API endpoint conversion
$converted = $exchange->convert('USD', 'EUR', 50);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.