2017 © Pedro Peláez
 

library fx-client

FX API PHP Client

image

payu/fx-client

FX API PHP Client

  • Tuesday, June 19, 2018
  • by drealecs
  • Repository
  • 9 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Build Status, (*1)

PHP client for FX API

Introduction

This is a PHP implementation of a HTTP client for accessing the FX API., (*2)

Installation

You can install the client by using composer:, (*3)

composer require payu/fx-client-php:^1.0

You need at least PHP 5.6, having cURL with HTTPS support enabled., (*4)

Usage

To begin, you will need to provide your account Merchant Code and Secret Key. To do this, create a \PayU\FX\Config\MerchantCredentials configuration instance:, (*5)

<?php

use PayU\FX\Config\MerchantCredentials;

require_once 'vendor/autoload.php';

$config = new MerchantCredentials(
    'MY_CODE',
    'MY_SECRET_KEY'
);

Next, create the API client by providing the above config instance and the platform/country you are going to use (possible values: Platform::RO(), Platform::TR(), Platform::RU()):, (*6)

<?php

use PayU\FX\Client;
use PayU\FX\Config\MerchantCredentials;
use PayU\FX\Config\Platform;

require_once 'vendor/autoload.php';

$config = new MerchantCredentials(
    'MY_CODE',
    'MY_SECRET_KEY'
);

$platform = Platform::RO();

$client = new Client($config, $platform);

Every method of the FX client is throwing the PayU\FX\Exceptions\ClientException exception is something won't work as expected. For instance:, (*7)

<?php

use PayU\FX\Client;
use PayU\FX\Config\MerchantCredentials;
use PayU\FX\Config\Platform;
use PayU\FX\Exceptions\ClientException;


require_once 'vendor/autoload.php';

$config = new MerchantCredentials(
    'MY_CODE',
    'MY_SECRET_KEY'
);

$platform = Platform::RO();

$client = new Client($config, $platform);

try {
    $client->getAllFxRates('RON');
} catch (ClientException $e) {
    echo $e->getMessage();
}

More example code can be found in examples dir., (*8)

License

This library is licensed under Apache-2.0 license. Please see the LICENSE file., (*9)

The Versions

19/06 2018

dev-master

9999999-dev

FX API PHP Client

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

19/06 2018

v0.1.0

0.1.0.0

FX API PHP Client

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

19/06 2018

dev-init

dev-init

FX API PHP Client

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires