Skip to content

Installation and Configuration

Igor Sazonov edited this page Jul 21, 2026 · 1 revision

This guide will walk you through installing the CoinQuant PHP SDK and configuring it for use in your PHP applications.

Requirements

Before installing the SDK, ensure your environment meets the following requirements:

  • PHP: Version 8.1 or higher.
  • Composer: The standard package manager for PHP.

The package automatically requires guzzlehttp/guzzle (^7.8) as its underlying HTTP client [1].

Installation

You can install the package via Composer. Run the following command in your terminal at the root of your project:

composer require tigusigalpa/coinquant-php

Authentication

CoinQuant uses a JWT bearer token for authentication. To obtain your token:

  1. Log in to the CoinQuant web app.
  2. Navigate to Settings → Service Accounts.
  3. Click on New key.
  4. Copy the generated access_token. Note: This token is shown only once.

Tokens are valid for 30 days and grant access to almost all endpoints (excluding human-profile surfaces like /v1/me and billing).

Security Warning: Never commit your API token to version control. Always use environment variables to store sensitive credentials.

Set your token as an environment variable:

export COINQUANT_TOKEN="your_access_token_here"

Basic Initialization

To use the SDK in a standalone PHP script, simply instantiate the CoinQuantClient with your token:

<?php

require __DIR__ . '/vendor/autoload.php';

use CoinQuant\CoinQuantClient;

$token = getenv('COINQUANT_TOKEN') ?: '';
$client = new CoinQuantClient($token);

// Test the connection
$health = $client->health();
echo "API Status: {$health['status']}\n";

// Check your credit balance
$credits = $client->getCredits();
echo "Available credits: {$credits['available_credits_total']}\n";

Customizing the HTTP Client

The SDK uses Guzzle under the hood. If you need to configure advanced HTTP options—such as setting custom timeouts, adding a proxy, or injecting middleware for logging and retries—you can pass a pre-configured GuzzleHttp\Client instance to the constructor [1].

use GuzzleHttp\Client as GuzzleClient;
use CoinQuant\CoinQuantClient;

$http = new GuzzleClient([
    'timeout' => 60.0,
    'proxy'   => 'tcp://localhost:8125',
    'headers' => [
        'Authorization' => 'Bearer ' . getenv('COINQUANT_TOKEN'),
        'Accept'        => 'application/json',
    ],
]);

$client = new CoinQuantClient(getenv('COINQUANT_TOKEN'), $http);

You can also update the client later using the setHttpClient() method:

$client->setHttpClient($newGuzzleClient);

Next Steps

If you are using the Laravel framework, proceed to the Laravel Integration guide to learn how to utilize the auto-discovered service provider and facade. Otherwise, check out Core Concepts & Streaming to start building strategies.


References

[1] CoinQuant PHP SDK README

Clone this wiki locally