seva-code/php-click-house-client

PHP Client for ClickHouse HTTP interface

dev-master / 1.3.x-dev 2024-06-14 17:41 UTC

This package is auto-updated.

Last update: 2024-09-14 18:20:46 UTC


README

PHP Client for ClickHouse HTTP interface

Use examples

$data = (new ChcClient())->getJsonData($query);
$client = new ChcClient();

try {
    if ($client->ping()) {
        $client->readOnly(true);
        $result = $client->getRaw($query, ChcFormat::JSONEachRow);
    } else {
        throw new Exception('ClickHouse is down.');
    }
}
catch (ChcException $e) {
    $error = $e->getMessage();
}
$latency = $client->getLastQueryLatency();

Install through Composer

"require": {
    "seva-code/php-click-house-client": "^1.2.0-dev"
}