2017 © Pedro Peláez
 

library php-currency-api

Wrapper for multiple currency rate APIs

image

rackbeat/php-currency-api

Wrapper for multiple currency rate APIs

  • Monday, June 25, 2018
  • by lasserafn
  • Repository
  • 2 Watchers
  • 4 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

API Wrapper for popular currency rate APIs

Dont worry about your favorite service suddenly shutting down or switching plans on you. Switch away easily., (*1)

Build Status Coverage Total Downloads Latest Stable Version License , (*2)

Supported APIs

Installation

You just require using composer and you're good to go!, (*3)

composer require rackbeat/php-currency-api

If you're using Laravel, a service provider and facade is included to provide configuration of driver etc., (*4)

Usage

Initialize instance

$api = Rackbeat\Currency\API::make('fixerio'); // driver from supported drivers.

Set base currency (default = USD)

$api->setBase(Rackbeat\Currency\Symbol::USD);

Set symbols to return (default = all/[])

$api->setSymbols([ Rackbeat\Currency\Symbol::DKK, Rackbeat\Currency\Symbol::EUR, Rackbeat\Currency\Symbol::USD ]);

Please note, you are not required to use Rackbeat\Currency\Symbol to specify symbols. It's simply a convenience helper., (*5)

Get latest rates

$api->get(); // Get latest rates for selected symbols, using set base currency
$api->get('DKK');  // Get latest rates for selected symbols, using DKK as base currency

Convert amount from one currency to another

$api->convert($fromCurrency = 'DKK', $toCurrency = 'EUR', 10.00); // Convert 10 DKK to EUR

Get rate on specific date

$api->historical($date = '2018-01-01'); // Get currency rate for base on 1st of January 2018
$api->historical($date = '2018-01-01', 'GBP'); // Get currency rate for GBP on 1st of January 2018

Laravel

... todo, (*6)

Requirements

  • PHP >= 7.1
  • Possibly a paid plan for your desired API. Check their pricing.

The Versions

25/06 2018

dev-master

9999999-dev

Wrapper for multiple currency rate APIs

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires

by Rackbeat

laravel api currency rates exchange rates currency conversion currency rates