2017 © Pedro Peláez
 

library client

Library for the Volabit API.

image

volabit/client

Library for the Volabit API.

  • Tuesday, September 1, 2015
  • by genaromadrid
  • Repository
  • 11 Watchers
  • 2 Stars
  • 16 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Volabit PHP Client

Volabit's API library for PHP. Integrate the Volabit services in your apps with ease., (*1)

You can see the available methods on the project wiki. Details of the API use can be found on the official page., (*2)

Installation

Using Composer:, (*3)

$ composer require volabit/client

Then, you may require the autoload script and use the Volabit namespace in your code:, (*4)

require 'vendor/autoload.php'

use Volabit\Client\OAuth2Client as VolabitClient;

Usage

1) Instance a new Volabit client object., (*5)

$app_id   = 'The registered API for your APP.';
$secret   = 'The registered secret for your APP.';
$callback = 'The registered callback URL for your APP';

$volabitClient = new VolabitClient($app_id, $secret, $callback);

Note that the by default the Volabit client uses the production environment. If you want to use the test environment, set the sandbox flag to true before requesting the authorization code., (*6)

$volabitClient->sandbox(true);

2) Get the URL that will allow the user to authorize your app to use his/her account. (It should be opened in a browser.), (*7)

$auth_url = $volabitClient->authorize();

3) After you get the authorization code (sent at the callback URL that you provided), you'll use it to get the refresh and access tokens. This code can be used only once, so be sure to store the token object for later use or your app will have to be reauthorized., (*8)

$volabitClient->getTokens('The given authorization code.');

Or, you can load previously obtained tokens from an array:, (*9)

$tokens = [
  'access_token' => 'an access token',
  'refresh_token' => 'a refresh token',
  'expires_in' => 'expiration time (unix time format)'
];

$volabitClient->useTokens($tokens);

4) With these tokens, you'll be ready to call the services. The methods will return a response array., (*10)

$response = $volabitClient->tickers();
print_r($response);
// Array
// (
//    [btc_usd_buy] => 236.42
//    [btc_usd_sell] => 236.51
//    [usd_mxn_buy] => 14.59
//    [usd_mxn_sell] => 15.19
//    [btc_mxn_buy] => 3450.44
//    [btc_mxn_sell] => 3592.64
// )

Note: If you get unauthorized error responses from the API, try to reauthorize your application and get new tokens., (*11)

You can see the available methods source on the corresponding section of the client. Details of the API use can be found on the official page., (*12)

Contributing

  1. Fork it ( https://github.com/[my-github-username]/php-api-client/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Bitdeli Badge, (*13)

The Versions

01/09 2015

dev-master

9999999-dev

Library for the Volabit API.

  Sources   Download

MIT

The Requires

 

The Development Requires

payments bitcoin volabit

01/04 2015

dev-development

dev-development

Library for the Volabit API.

  Sources   Download

MIT

The Requires

 

The Development Requires

payments bitcoin volabit

01/04 2015

v1.0.2

1.0.2.0

Library for the Volabit API.

  Sources   Download

MIT

The Requires

 

The Development Requires

payments bitcoin volabit

23/02 2015

v1.0.1

1.0.1.0

Library for the Volabit API.

  Sources   Download

MIT

The Requires

 

The Development Requires

payments bitcoin volabit

19/02 2015

v1.0.0

1.0.0.0

Library for the Volabit API.

  Sources   Download

MIT

The Requires

 

The Development Requires

payments bitcoin volabit