PHP Classes

PHP API for Currency Conversion: Convert currencies using multiple conversion APIs

Recommend this page to a friend!
  Info   View files Documentation   View files View files (14)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 68 This week: 1All time: 10,286 This week: 560Up
Version License PHP version Categories
currency-converter-u 1.0.0Custom (specified...5.4PHP 5, Web services, Finances
Description 

Author

This package can convert currencies using multiple conversion APIs.

It can take a given amount and convert it to another currency by using one of several support currency conversion APIs.

The class may call an API defined in a configuration variable, or call an API passed specifically at runtime with a name defined as a parameter.

Picture of Shashwat Mishra
Name: Shashwat Mishra <contact>
Classes: 3 packages by
Country: India India
Age: 27
All time rank: 4276295 in India India
Week rank: 411 Up26 in India India Up
Innovation award
Innovation award
Nominee: 1x

Documentation

?Currency Tool

Introduction

Smart Currency PHP Library utilizes the Smart Caching and Certain API providers to convert currency without having the need to pay anything. It saves your quotas of free plans of the API Providers. Smart Currency makes your currency conversions smarter with a "Self-drive" Mode. It utilizes Composer to manage it as a Package and helps you to use the library from your own private repository too.

You don't need to Pay Anything to any Currency Exchange API providers, all you need is their Free/Basic Accounts and feed the Smart Currency Library with your API Keys. It will smartly convert the amount to your desired Currency. We have built a self-drive mode to help you to cut the chase, just complete your configuration file with "selfdrive"=>true and run the Currency Conversion like a charm.

Usage

Just a Show-off Currency Conversion with Smart Currency Library is as simple as:

$currency = new Secrethash\Currency\Currency;

echo $currency->convert(100, 'USD', 'INR');

Follow the Steps: 1. Require the composer autoloader:

<?php
require ('vendor/autoload.php?);
  1. Call the Package:
    $currency = new Secrethash\Currency\Currency;
    $currency->convert(100, 'USD?, 'INR?);
    $currency->convertWith('exchangerate?, 100, 'INR?, 'USD?);
    

Roadmap

  • [ ] Laravel Service Provider
  • [ ] Laravel Publish Config
  • [ ] Publishing Configuration file
  • [x] Smart Caching (via gilbitron/PHP-SimpleCache)
  • [x] Self-Drive Mode
  • [x] Composer Project
  • [x] Extensive Providers

Installation

Just run:

composer require secrethash/currency

Function explained:

1. convert();

convert(int $amount, string $from, string $to)

Three Parameters, namely - Amount, From, To - $amount: (Type: Integer) Accepts the amount to convert. - $from: (Type: String) Accepts String with Currency Code (ex: USD or INR) - $to: (Type: String) Accepts String with Currency Code (ex: USD or INR)

2. convertWith();

convertWith(string $provider, int $amount, string $from, string $to)

Same as convert() except an additional provider parameter. - $provider: (Type: String) API Service Provider that is Available (ex: exchangerate or currencylayer). - $amount: (Type: Integer) Amount to be converted - $from: (Type: String) Accepts String with Currency Code (ex: USD or INR) - $to: (Type: String) Accepts String with Currency Code (ex: USD or INR)


  Files folder image Files  
File Role Description
Files folder image.github (1 file)
Files folder imagesrc (2 files, 3 directories)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file composer.lock Data Auxiliary data
Accessible without login Image file display.jpg Icon Icon image
Accessible without login Image file just-a-showoff.png Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  .github  
File Role Description
  Accessible without login Plain text file FUNDING.yml Data Auxiliary data

  Files folder image Files  /  src  
File Role Description
Files folder imageconfig (1 file)
Files folder imageEngine (1 file)
Files folder imageProviders (3 directories)
  Plain text file Config.php Class Class source
  Plain text file Currency.php Class Class source

  Files folder image Files  /  src  /  config  
File Role Description
  Accessible without login Plain text file config.example.php Aux. Auxiliary script

  Files folder image Files  /  src  /  Engine  
File Role Description
  Plain text file Backbone.php Class Class source

  Files folder image Files  /  src  /  Providers  
File Role Description
Files folder imageCurrencylayer (1 file)
Files folder imageExchangerate (1 file)
Files folder imageSmartConvert (1 file)

  Files folder image Files  /  src  /  Providers  /  Currencylayer  
File Role Description
  Plain text file Currencylayer.php Class Class source

  Files folder image Files  /  src  /  Providers  /  Exchangerate  
File Role Description
  Plain text file Exchangerate.php Class Class source

  Files folder image Files  /  src  /  Providers  /  SmartConvert  
File Role Description
  Plain text file API.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:68
This week:1
All time:10,286
This week:560Up