Skip to content

Configuration

Igor Sazonov edited this page Jan 31, 2026 · 1 revision

Configuration

Properly configuring the bingx-php SDK is essential for connecting to the BingX API. This guide covers the configuration for both standalone PHP projects and Laravel applications.

Standalone PHP Configuration

For projects that do not use Laravel, you can instantiate the BingxClient class directly. The constructor requires your API key and secret.

use Tigusigalpa\BingX\BingxClient;

$apiKey = 'your-api-key';
$apiSecret = 'your-api-secret';

$bingx = new BingxClient($apiKey, $apiSecret);

// You can also specify the base URI and other options
$bingx = new BingxClient(
    $apiKey,
    $apiSecret,
    'https://open-api-vst.bingx.com' // Use the testnet URI
);
Parameter Type Default Description
apiKey string Your BingX API key.
apiSecret string Your BingX API secret.
baseUri string https://open-api.bingx.com The base URI for the API. Use https://open-api-vst.bingx.com for the testnet.
sourceKey ?string null An optional source key for brokers.
signatureEncoding string base64 The encoding for the HMAC signature (base64 or hex).

Laravel Configuration

For Laravel applications, the recommended way to configure the SDK is by using environment variables.

1. Publish the Configuration File

If you haven't already, publish the configuration file:

php artisan vendor:publish --tag=bingx-config

This creates the config/bingx.php file, which reads the settings from your .env file.

2. Set Environment Variables

Add your BingX API credentials and other settings to your .env file:

BINGX_API_KEY=your_api_key_here
BINGX_API_SECRET=your_api_secret_here
BINGX_BASE_URI=https://open-api.bingx.com

The SDK will automatically use these settings when you use the Bingx facade or inject the client through the service container.

Creating API Keys

To get your API key and secret, follow these steps:

  1. Log in to your BingX account.
  2. Navigate to the API Management section.
  3. Click Create API.
  4. Configure the API permissions as needed.
  5. Securely store your API key and secret. The secret key is only displayed once.

Next Steps

With the SDK configured, you are now ready to start making API calls. Proceed to the Quick Start guide for a hands-on example.

Clone this wiki locally