Skip to content

axm-sysdev/td-client-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Treasure Data API library for PHP

Treasure Data API library for PHP

Requirements

  • PHP 8.0+

Installation

composer require axm-sysdev/td-client-php

Usage

<?php

require_once 'vendor/autoload.php';

use AXM\TD\Client;
use AXM\TD\Job;

$client = new Client('YOUR-API-KEY-HERE');

$jobId = $client->query('mydatabase', 'hive', 'SELECT * FROM mytable WHERE value >= 500');

while (true) {
    $status = $client->jobStatus($jobId);
    if (Job::isFinished($status)) {
        break;
    }
    sleep(1);
}

$result = $client->jobResult($jobId);

Query options

$client->hiveQuery($dbName, $query, ['priority' => Job::PRIORITY_VERY_HIGH, 'engine_version' => 'stable']);

Client Options

Use the guzzle option.
Document.

$options['client_config'] = ['timeout' => 1];

$client = new Client('YOUR-API-KEY-HERE', $options);

About

Treasure Data API library for PHP

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages