victoravelar/fixer-exchange

This package is abandoned and no longer maintained. No replacement package was suggested.

API client to interact with Fixer.io

v1.0.0 2019-03-10 09:09 UTC

This package is auto-updated.

Last update: 2022-03-10 16:43:11 UTC


README

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.