A PHP library for communicating with the Reloadly API.
The documentation for the Reloadly API can be found here.
The PHP library documentation can be found here.
reloadly-php uses a modified version of Semantic Versioning for all changes.
This library supports the following PHP implementations:
You can install reloadly-php via composer or by downloading the source.
reloadly-php is available on Packagist as the
daibe/reloadly-php package:
composer require daibe/reloadly-php
Alternatively, you can specify the reloadly-php package as a dependency in your project’s existing composer.json file:
 {
   "require": {
     "daibe/reloadly-php": "^1.0.3"
   }
}
After installing, you need to require Composer’s autoloader:
<?php
    require __DIR__.'/vendor/autoload.php';
You can find out more on how to install Composer, configure autoloading, 
and other best-practices for defining dependencies at getcomposer.org.
<?php
    use ReloadlyPHP\Client;
    
    // Instantiate ReloadlyPHP 
    $reloadly = new Client('yourClientId', 'yourClientSecret');
Sandbox or live production mode
<?php
    use ReloadlyPHP\Client;
    $isProd = (bool) App::environment('production'); // Laravel
    
    // Instantiate ReloadPHP 
    $reloadly = new Client('yourClientId', 'yourClientSecret', $isProd);
// Check your account's balance using Reloadly's REST API and PHP
<?php
    use ReloadlyPHP\Client;
    $client_id      = 'ACXXXXXX'; // Your developer client secret from www.reloadly.com/dashboard
    $client_secret  = 'YYYYYY'; // Your developer client password from www.reloadly.com/dashboard
    
    try {
    
        $reloadly   = new Client($client_id, $client_secret);
        $balance    = $reloadly->getBalance();
    
        echo '<pre>';
        echo sprintf("Amount: <strong>%s</strong> <br/>", $balance->getBalance());
        echo sprintf("Currency name: <strong>%s</strong> <br/>", $balance->getCurrencyName());
        echo sprintf("Currency code: <strong>%s</strong> <br/>", $balance->getCurrencyCode());
        echo '</pre>';
        
    } catch (Exception $e) {
        echo "Exception: ".$e->getMessage();
    }
<?php
    try {    
        $operators = $reloadly->getOperators();
        
        echo '<pre>';
        foreach ($operators as $operator) {
            echo sprintf("Operator name: <strong>%s</strong> <br/>", $operator->getName());
            echo sprintf("Operator ID: <strong>%d</strong> <br/>", $operator->getOperatorId());
        }
        echo '</pre>';
    
    } catch (Exception $e) {
        // ... 
    }
<?php
    try {    
        
        $fxRate = $reloadly->getFxRate(506, 1);
    
        if ($fxRate) {
            echo sprintf("Name: <strong>%s</strong> <br/>", $fxRate->getName());
            echo sprintf("FX Rate: <strong>%s</strong> <br/>", $fxRate->getFxRate());
            echo sprintf("Currency Code: <strong>%s</strong> <br/>", $fxRate->getCurrencyCode());
            echo sprintf("Operator ID: <strong>%d</strong> <br/>", $fxRate->getOperatorId());
        }
    
    } catch (Exception $e) {
        // ... 
    }
Anyone can contribute to improve or fix ReloadlyPHP, to do so you can either report an issue (a bug, an idea…) or fork the repository, perform modifications to your fork then request a merge.