2017 © Pedro Peláez
 

dev converter

Currency converter

image

ineersa/converter

Currency converter

  • Saturday, February 13, 2016
  • by ineersa
  • Repository
  • 1 Watchers
  • 1 Stars
  • 14 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

currency-converter

Simple API for currency converting., (*1)

Currently using ECB currency rates service. http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml, (*2)

Instalation:

composer require ineersa/converter, (*3)

Features:

  • results caching
  • easy to extend
  • fast?

Examples of usage:

Basic usage:, (*4)

use Ineersa\Converter\Converter;
use Ineersa\Converter\Services\EcbService;

$converter = new Converter(new EcbService());
echo $converter->convert('USD','RUB',100);

Get available currencies list:, (*5)

$service = new EcbService();
$service->getCurrenciesList();

Get single currency rate for euro:, (*6)

$service = new EcbService();
echo $service->getRate('USD');

You can control what client, adapter or cache you want to use via service. For example:, (*7)

$cache = new MemcacheCache();
$service = new EcbService($cache);
echo $service->getRate('USD');

openexchangerates was added in version 1.0.1

To get appp_id token visit openexchangerates and sign up., (*8)

Free plan exists (1000 requests per month), which is fairly enough for simple usage., (*9)

Examples of usage:

Basic usage:, (*10)

    $service = new OpenExchangeRatesService();
    $service->getClient()->setAppId('YOUR_APP_ID_TOKEN');
    $converter = new Converter($service);
    echo $converter->convert('USD','RUB',1);

Specific features for paid plans:, (*11)

    $service = new OpenExchangeRatesService();
    $service->getClient()->setAppId('YOUR_APP_ID_TOKEN');
    $service->getClient()->setBase('EUR');//You can control your base currency
    $service->getClient()->setSymbols('EUR,USD,RUB');//You can control what currencies you need in response
    $converter = new Converter($service);
    echo $converter->convert('USD','RUB',1);

By default Memcached, Guzzle used. To use your own, implement appropriate interfaces., (*12)

Demo, (*13)

The Versions

13/02 2016

dev-master

9999999-dev

Currency converter

  Sources   Download

The Requires

 

The Development Requires

by Illya Vasylevskiy

13/02 2016

v1.0.1

1.0.1.0

Currency converter

  Sources   Download

The Requires

 

The Development Requires

by Illya Vasylevskiy

30/01 2016

v1.0.0

1.0.0.0

Currency converter

  Sources   Download

The Requires

 

The Development Requires

by Illya Vasylevskiy