seva-code/php-click-house-client

ClickHouse HTTP接口的PHP客户端

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客户端用于ClickHouse HTTP接口

使用示例

$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();

通过Composer安装

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