2017 © Pedro Peláez
 

library currency

currency api for laravel

image

marleysidapple/currency

currency api for laravel

  • Monday, September 12, 2016
  • by marleysidapple
  • Repository
  • 1 Watchers
  • 1 Stars
  • 4 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Currency Exchange Rates

Get latest currency exchange rates for different dates., (*1)

Prerequisities

this will require guzzle. so first make sure you have installed guzzle., (*2)

"guzzlehttp/guzzle": "~4.0"

Installing

To install, edit your composer.json and add the line mentioned below., (*3)

"marleysidapple/currency": "dev-master"

Then run composer update, (*4)

Configuration

After installation, go to config/app.php. Add in provider array, (*5)

 Marleysid\Currency\CurrencyServiceProvider::class,

Add alias as well in alias array, (*6)

 'Currency'=> Marleysid\Currency\Facade\CurrencyFacade::class,

For publishing configuration. Run following command, (*7)

php artisan vendor:publish

Once publish is completed, open config/currency.php. It contains two element. One is url which is an api endpoint and another one is baseCurrency. You can change baseCurrency and set standard currency of your own, however url value is not meant to be changed., (*8)

Example

add use Currency; in the top of the controller., (*9)

$exchangeRate = Currency::exchangeRate('baseCurrency', 'date', 'conversionCurrency');

if baseCurrency is set to GBP, all the conversion rates will be show in respect to GBP as a base. Passing date will give the exchange rate for that particular date. And passing conversionCurrency will give the exchange Rate for that particular conversionCurrency in respect to the specified baseCurrency., (*10)

Usage

$exRate = Currency::exchangeRate('USD');

returns all available exrates with respect to the USD as a base currency for present date., (*11)

$exRate = Currency::exchangeRate('USD', '2015-10-23');

returns exrates for the specified date, (*12)

$exRate = Currency::exchangeRate('USD', '2015-10-23', 'AUD');

returns exrate of 1 USD to 1 AUD on specified date, (*13)

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us., (*14)

Authors

License

This project is licensed under the MIT License - see the LICENSE.md file for details, (*15)

Acknowledgments

  • http://fixer.io/

The Versions

12/09 2016

dev-master

9999999-dev https://github.com/marleysidapple/currency

currency api for laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Siddhartha

currency exchange-rate currency-exchange-api currency-exchange