byte5digital/currency-converter

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

Converts currencies with fixer.io API.

2.0 2018-06-08 13:22 UTC

This package is not auto-updated.

Last update: 2022-02-01 13:11:29 UTC


README

Software License Travis Total Downloads

Important: Since fixer.io updated their API you have to register for an account to use this package! This package does not support premium features of fixer.io yet! If you are using fixer.io premium's features, you might not even need this package anymore => take a look at the /convert endpoint.

Install

Laravel Version 5.6+

composer require byte5digital/currency-converter

in your .env add your fixer.io api key FIXER_API_KEY=Your_api_key

optional php artisan vendor:publish --provider="Byte5\CurrencyConverter\CurrencyConverterServiceProvider"

Usage

// Converting currencies
Currency::convert(100, 'EUR')->into('USD');

// get currency rates
Currency::getLatestRates();

// get rates for different base (default: EUR)
Currency::setBase('USD')->getLatestRates();

// get specific currency rates
Currency::getLatestRates(['USD', 'GBP']);
Currency::getLatestRates('USD');

// get historical currency rates
Currency::getHistoricalRates('2000-01-03');
Currency::getHistoricalRates(Carbon::yesterday());
Currency::getHistoricalRates('2000-01-03', ['USD', 'GBP']);

Testing

currently not working => did not have the time to update tests after fixer.io Api update.

Run the tests with:

vendor/bin/phpunit

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security-related issues, please email kkoenig@byte5.de instead of using the issue tracker.

License

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