qalbit/exchangescoop

A simple currency exchange library in PHP using CurrencyScoop.

v1.0.0 2021-07-12 15:12 UTC

This package is auto-updated.

Last update: 2025-06-12 23:39:29 UTC


README

A simple PHP library to convert and get latest exchange rate from Exchange Rate API.

Requirements

PHP 5.6.0 and later.

Composer

You can install the bindings via Composer. Run the following command:

composer require qalbit/exchangescoop

To use the bindings, use Composer's autoload:

require_once('vendor/autoload.php');

Dependencies

The bindings require the following extensions in order to work properly:

  • curl, although you can use your own non-cURL client if you prefer

Getting Started

Simple example looks like:

$scoop = new Exchange("YOUR_EXCHANGE_RATE_API_KEY");

// Set base currency
$scoop->setBaseCurrency("AUD");

// Get latest exchange rate
$exchange_rates = $scoop->getLatestExchangeRate();
print_r($exchange_rates);

Convert currency

// Convert your currency
$target_currency = "USD";
$amount_to_convert = 100;
$converted_amount = $scoop->convert($target_currency, $amount_to_convert);
print_r($converted_amount);

Author

Licensing & Support

Copyright © QalbIT Solution
Licensed under the MIT license.