PHP code example of loranger / questdb-client

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

    

loranger / questdb-client example snippets


\QuestDB\Client::setServer('questdb_server', 9009);

\QuestDB\Client::ping('trades,symbol=BTC-USD,side=sell');

new \QuestDB\ILPQueryBuilder(string $table, array $values, int $timestamp = null);

$ilp_query = new \QuestDB\ILPQueryBuilder('trades', [
    'symbol' => 'BTC-USD',
    'side' => 'sell'
]);

echo $ilp_query;
// trades,symbol=BTC-USD,side=sell

\QuestDB\Client::ping($ilp_query);

\QuestDB\Client::ping('trades', [
    'symbol' => 'BTC-USD',
    'side' => 'sell'
], time());

\QuestDB\Client::ping('trips', [
    'cab_type:symbol' => 'yellow',
    'passenger_count:int' => 3,
    'trip_distance:double' => 6.3,
    'payment_type' => 'cash',
]);

echo (new \QuestDB\ILPQueryBuilder('trips', [
    'cab_type:symbol' => 'yellow',
    'passenger_count:int' => 3,
    'trip_distance:double' => 6.3,
    'payment_type' => 'cash',
]));

// trips,cab_type=yellow,payment_type=cash passenger_count=3i,trip_distance=6.300000