victoravelar / fixer-exchange
API client to interact with Fixer.io
Installs: 1 045
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: ~7.1
- guzzlehttp/guzzle: ^6.3
Requires (Dev)
- ext-json: *
- friendsofphp/php-cs-fixer: ^2.14
- phpmd/phpmd: ^2.6
- phpunit/phpunit: >=7.0
- squizlabs/php_codesniffer: ^3.0
This package is auto-updated.
Last update: 2022-03-10 16:43:11 UTC
README
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.