Looking to hire Laravel developers? Try LaraJobs

laravel-openexchangerates maintained by apvalkov

Description
Laravel SDK for https://openexchangerates.org api
Author
Last update
2023/07/06 13:31 (dev-master)
License
Links
Downloads
729

Comments
comments powered by Disqus

Laravel openexchangerates

Installation

Require this package with composer using the following command:

composer require apvalkov/laravel-openexchangerates

Add the following class to the providers array in config/app.php:

Apvalkov\LaravelOpenexchangerates\ServiceProvider::class,

You can also publish the config file to change implementations (ie. interface to specific class).

php artisan vendor:publish --provider="Apvalkov\LaravelOpenexchangerates\ServiceProvider"

Set your openexchangerates app id

OPEN_EXCHANGE_RATES_APP_ID=your-app-id-here

How to use

// Latest
$rates = (new Openexchangerates())->latest(new LatestRatesRequest());

//Historical
$rates = (new Openexchangerates())->historical(new LatestRatesRequest(), Carbon::now());