byte5digital / currency-converter
Converts currencies with fixer.io API.
Installs: 59
Dependents: 0
Suggesters: 0
Security: 0
Stars: 19
Watchers: 4
Forks: 1
Open Issues: 0
Type:package
Requires
- illuminate/support: 5.6.*
- kitetail/zttp: ^0.3.0
Requires (Dev)
- orchestra/testbench: ^3.6
README
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.