2017 © Pedro Peláez
 

library nbp-currency-converter

Retrieve average currency exchange rates from the NBP website and convert an amount from one currency to another.

image

ksdev/nbp-currency-converter

Retrieve average currency exchange rates from the NBP website and convert an amount from one currency to another.

  • Thursday, August 13, 2015
  • by ksdev
  • Repository
  • 1 Watchers
  • 1 Stars
  • 3,036 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 6 Versions
  • 6 % Grown

The README.md

NBP currency converter

Latest Version on Packagist ![Software License][ico-license] Build Status ![Coverage Status][ico-scrutinizer] Quality Score, (*1)

Retrieve average currency exchange rates from the NBP website and convert an amount from one currency to another., (*2)

Install

Via Composer, (*3)

``` bash $ composer require ksdev/nbp-currency-converter, (*4)


## Usage If optional table publication date is not passed to `convert` or `averageExchangeRates` methods, the last published average exchange rates table will be used, starting from yesterday, so e.g. on 2015-07-10 (friday) a table from 2015-07-09 (thursday) will be used, and on 2015-07-12 (sunday) a table from 2015-07-10 (friday) - unless no table was published on this day, then the table from previous day will be used, etc. ``` php use Ksdev\NBPCurrencyConverter\CurrencyConverter; use Ksdev\NBPCurrencyConverter\ExRatesTableFinder; use Ksdev\NBPCurrencyConverter\ExRatesTableFactory; use GuzzleHttp\Client; $converter = new CurrencyConverter( new ExRatesTableFinder( new Client(), new ExRatesTableFactory(), 'path/to/cache/folder' ) ); try { $result = $converter->convert('123.4567', 'PLN', 'USD'); $avgExRates = $converter->averageExchangeRates(); } catch (Exception $e) { // }
$result

``` php array( 'publication_date' => '2015-07-03', 'amount' => '32.7246', 'currency' => 'USD' );, (*5)


###### $avgExRates ```php array( 'numer_tabeli' => '127/A/NBP/2015', 'data_publikacji' => '2015-07-03', 'waluty' => array( 'PLN' => array( 'nazwa_waluty' => 'złoty polski', 'przelicznik' => '1', 'kurs_sredni' => '1', ), 'THB' => array( 'nazwa_waluty' => 'bat (Tajlandia)', 'przelicznik' => '1', 'kurs_sredni' => '0,1117', ), 'USD' => array( 'nazwa_waluty' => 'dolar amerykański', 'przelicznik' => '1', 'kurs_sredni' => '3,7726', ), 'AUD' => array(...) ) );

Testing

bash $ composer test, (*6)

License

The MIT License (MIT). Please see License File for more information., (*7)

The Versions

13/08 2015

dev-master

9999999-dev https://github.com/ksdev-pl/nbp-currency-converter

Retrieve average currency exchange rates from the NBP website and convert an amount from one currency to another.

  Sources   Download

MIT

The Requires

 

The Development Requires

ksdev nbp-currency-converter

13/08 2015

0.2.3

0.2.3.0 https://github.com/ksdev-pl/nbp-currency-converter

Retrieve average currency exchange rates from the NBP website and convert an amount from one currency to another.

  Sources   Download

MIT

The Requires

 

The Development Requires

ksdev nbp-currency-converter

12/07 2015

0.2.2

0.2.2.0 https://github.com/ksdev-pl/nbp-currency-converter

Retrieve average currency exchange rates from the NBP website and convert an amount from one currency to another.

  Sources   Download

MIT

The Requires

 

The Development Requires

ksdev nbp-currency-converter

05/07 2015

0.2.1

0.2.1.0 https://github.com/ksdev-pl/nbp-currency-converter

Retrieve average currency exchange rates from the NBP website and convert an amount from one currency to another.

  Sources   Download

MIT

The Requires

 

The Development Requires

ksdev nbp-currency-converter

05/07 2015

0.2.0

0.2.0.0 https://github.com/ksdev-pl/nbp-currency-converter

Retrieve average currency exchange rates from the NBP website and convert an amount from one currency to another.

  Sources   Download

MIT

The Requires

 

The Development Requires

ksdev nbp-currency-converter

04/07 2015

0.1.0

0.1.0.0 https://github.com/ksdev-pl/nbp-currency-converter

Retrieve average currency exchange rates from the NBP website and convert an amount from one currency to another.

  Sources   Download

MIT

The Requires

 

The Development Requires

ksdev nbp-currency-converter