PHP Client for ClickHouse HTTP interface
$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"
}