Skip to content
API wrapper to interact with https://fixer.io free tier service.
PHP
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.
.github
src
tests
.gitattributes
.gitignore
.scrutinizer.yml
.styleci.yml
.travis.yml
CHANGELOG.md
LICENSE.md
README.md
composer.json
examples.php
phpcs.xml.dist
phpunit.xml.dist

README.md

fixer-exchange

Latest Version on Packagist Software License StyleCI Build Status Coverage Status Quality Score Total Downloads

This package is an API wrapper to interact with fixer.io free tier service.

Install

Via Composer

$ composer require victoravelar/fixer-exchange

Usage

For a test run you can execute the Examples file.

You will need to set up an API key, you can grab one for free at fixer.io

$ php examples.php
<?php // example.php

use GuzzleHttp\Exception\GuzzleException;
use Psr\Http\Message\ResponseInterface;
use VictorAvelar\Fixer\FixerHttpClient;
use VictorAvelar\Fixer\Resources\CurrencySupportResource;
use VictorAvelar\Fixer\Resources\LatestRatesResource;

require 'vendor/autoload.php';

// Get all supported symbols
$client = new FixerHttpClient('YOUR_KEY_HERE');

$endpoint = new CurrencySupportResource($client);

try {
    $results = $endpoint->execute();
} catch (GuzzleException $e) {
    echo $e->getMessage();
}

echo PHP_EOL;

/** @var ResponseInterface $results */
print_r($results->getBody()->getContents());

// Get the latest exchange rates
$endpoint = new LatestRatesResource($client);

try {
    $latest = $endpoint->execute();
} catch (GuzzleException $e) {
    echo $e->getMessage();
}

print_r($latest->getBody()->getContents());

Change log

Please see CHANGELOG for more information on what has changed recently.

Testing

$ composer test

Contributing

Please see CONTRIBUTING and CODE_OF_CONDUCT for details.

TODO

  • Implement Historical endpoint
  • Implement Currency exchange service
  • Implement converter to Fowler's money principle

Security

If you discover any security related issues, please email deltatuts@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

You can’t perform that action at this time.