PHP code example of netcoins / netcoins-sdk-php

1. Go to this page and download the library: Download netcoins/netcoins-sdk-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

netcoins / netcoins-sdk-php example snippets


use Netcoins/Client as Netcoins;

$netcoins = new Netcoins([
    'token' => 'your_given_auth_token',
    'environment' => 'sandbox',
]);

...

...

$assets = $netcoins->assets();

print_r($assets);

// outputs:
/*
array(14) {
  ["BTC:CAD"] => string(26) "Bitcoin - Canadian Dollars"
  ["LTC:USD"] => string(27) "Litecoin - American Dollars"
  ...
}
*/

...

$prices = $netcoins->prices();
//or
$prices = $netcoins->prices('btc', 'cad');

// outputs:
/*
array(14) {
  ["BTC:CAD"] => array(3) {
    ["buy"] => string(8) "13639.86"
    ["sell"] => string(8) "13474.29"
    ["date"] => string(19) "2020-09-11 07:27:03"
  },
  ...
}
*/
bash
composer