PHP Classes

File: examples/IntervalDetails.php

Recommend this page to a friend!
  Classes of T. H.   Druid PHP Client   examples/IntervalDetails.php   Download  
File: examples/IntervalDetails.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Druid PHP Client
Send queries to a Apache Druid service
Author: By
Last change:
Date: 5 years ago
Size: 740 bytes
 

Contents

Class file image Download
<?php
declare(strict_types=1);

error_reporting(E_ALL);
ini_set('display_errors', 'On');

include
__DIR__ . '/../vendor/autoload.php';
include
__DIR__ . '/helpers/ConsoleLogger.php';
include
__DIR__ . '/helpers/ConsoleTable.php';

use
Level23\Druid\DruidClient;
use
Level23\Druid\Context\TopNQueryContext;

try {
   
$client = new DruidClient(['router_url' => 'http://127.0.0.1:8888']);

   
$response = $client->metadata()->interval('wikipedia', '2015-09-12T00:00:00.000Z/2015-09-13T00:00:00.000Z');

   
// See the raw response.
   
var_export($response);

} catch (
Exception $exception) {
    echo
"Something went wrong during retrieving druid data\n";
    echo
$exception->getMessage() . "\n";
    echo
$exception->getTraceAsString();
}