-
Notifications
You must be signed in to change notification settings - Fork 0
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.
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). |
For Laravel applications, the recommended way to configure the SDK is by using environment variables.
If you haven't already, publish the configuration file:
php artisan vendor:publish --tag=bingx-configThis creates the config/bingx.php file, which reads the settings from your .env file.
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.comThe SDK will automatically use these settings when you use the Bingx facade or inject the client through the service container.
To get your API key and secret, follow these steps:
- Log in to your BingX account.
- Navigate to the API Management section.
- Click Create API.
- Configure the API permissions as needed.
- Securely store your API key and secret. The secret key is only displayed once.
With the SDK configured, you are now ready to start making API calls. Proceed to the Quick Start guide for a hands-on example.