Skip to content

Laravel exchange rate wrapper for different currencies using multipe providers

License

Notifications You must be signed in to change notification settings

norbybaru/exchange-rate

Repository files navigation

Laravel Exchange Rate

Allows to convert money from one currency to another using latest exchange rate on market

Installation

$ composer install norbybaru/exchange-rate

Publish Config config/exchange.php

$ php artisan vendor:publish --provider="NorbyBaru\ExchangeRate\ExchangeRateServiceProvider"

Run Migration

$ php artisan migrate

Usage

Update exchange rate to get latest rate on the market. Run below command to get latest exchange rate

$ php artisan rate:update
  • Get Rate
<?php
use NorbyBaru\ExchangeRate\Facades\Exchange;

$rate = Exchange::rate("USD");
  • Convert Currency
<?php

use NorbyBaru\ExchangeRate\Facades\Exchange;

$money = Exchange::convert(5000, 'USD', 'ZAR');