PHP code example of binance / binance-connector-php

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

    

binance / binance-connector-php example snippets


    $configurationBuilder = SpotRestApiUtil::getConfigurationBuilder();
    $configurationBuilder->apiKey('apiKey')->secretKey('mySecretKey');
    $api = new SpotRestApi($configurationBuilder->build());

    $configurationBuilder = SpotRestApiUtil::getConfigurationBuilder();
    $configurationBuilder
    ->apiKey('apiKey')
    ->privateKey('file:///path/to/private.key')
    // if the private key is protected by a password
    ->privateKeyPass("myPrivateKeyPass");
    
    $api = new SpotRestApi($configurationBuilder->build());

    // set up a client array
    $configurationBuilder = SpotRestApiUtil::getConfigurationBuilder();
    // define the proxies
    $proxies = [
        'http'  => 'http://localhost:8080',
        'https' => 'http://localhost:8080',
    ];

    $configurationBuilder->setProxy($proxies);

    $api = new SpotRestApi($configurationBuilder->build());
bash
composer