PHP code example of mvaessen / binance-api

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

    

mvaessen / binance-api example snippets



$api = new Mvaessen\BinanceApi\Client('<api key>','<secret>');

$result = $api->account();
print $result;

$result = $api->queryPublic('<method>', '<endpoint>', '<request>');

$result = $api->queryPrivate('<method>', '<endpoint>', '<request>');


namespace App;

use Mvaessen\BinanceApi\BinanceApiException;
use Mvaessen\BinanceApi\Client;

class BinanceApi extends Client
{
   protected function processErrorCode($response, $method, $url, $request)
   {
       //todo report to bugtracking software

       throw new BinanceApiException($response['msg']);
   }
   
   protected function processException($e, $method, $url, $request)
   {
       //todo report to bugtracking software

       throw new BinanceApiException($e->getMessage());
   }
}