apvalkov/laravel-openexchangerates

Laravel SDK for https://openexchangerates.org api

v0.0.1 2023-07-06 11:31 UTC

This package is auto-updated.

Last update: 2024-05-10 13:16:04 UTC


README

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());