PHP code example of luno / luno-php

1. Go to this page and download the library: Download luno/luno-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/ */

    

luno / luno-php example snippets


$client = new Luno\Client();
$client->setAuth("api_key_id", "api_key_secret");

$req = new Luno\Request\GetOrderBook();
$req->setPair("XBTZAR");

try {
  $res = $client->getOrderBook($req);
  echo "Found " . count($res->getBids()) . " bid(s)";
} catch (Luno\Error $e) {
  echo $e->message();
}

composer