ujjwal/currency-converter

Currency Converter Class with features of caching and identifying currency from country Code

Installs: 2 139

Dependents: 0

Stars: 23

Watchers: 3

Forks: 8

Language: PHP

2.2.1 2015-03-21 05:09 UTC

README

Master Branch Build Status Latest Stable Version Latest Unstable Version Total Downloads Scrutinizer Code Quality Code Coverage

Currency Converter Library with features of caching and identifying currency from country Code

Getting started

<?php
require 'vendor/autoload.php';

$converter = new CurrencyConverter\CurrencyConverter;
echo $converter->convert('USD', 'NPR'); // will print something like 97.44

// caching currency

$cacheAdapter = new CurrencyConverter\Cache\Adapter\FileSystem(__DIR__ . '/cache/');
$cacheAdapter->setCacheTimeout(DateInterval::createFromDateString('10 second'));
$converter->setCacheAdapter($cacheAdapter);
echo $converter->convert('USD', 'NPR');

Why Use It

  • Reliable Rate, Uses Yahoo API
  • Caching of rate, to avoid connecting to Yahoo again and again
  • Conversion without curreny code(from country code)

Requirements

  • PHP version 5.4 or later
  • Curl Extension (Optional)

Installation

This library depends on composer for installation . For installation of composer, please visit getcomposer.org.

Add "ujjwal/currency-converter":"2.2.*" to your composer.json and run php composer.phar update

Usage

Please head on to /examples folder.

For further documentation, please look at the /docs.