mjf9999/redash-api-client
最新稳定版本:1.0.4
Composer 安装命令:
composer require mjf9999/redash-api-client
包简介
re:dash results API client for PHP.
README 文档
README
re:dash results API client for PHP.
Installaton
$ composer require mjf9999/redash-api-client
Usage
<?php require __DIR__ . '/../vendor/autoload.php'; define('REDASH_URL', 'http://localhost:5000/'); define('REDASH_QUERY_API_KEY', 'REDASH_QUERY_API_KEY'); define('REDASH_USER_API_KEY', 'REDASH_USER_API_KEY'); define('REDASH_QUERY_ID', 1); // Fetch data without refresh option. // You can fetch data without User API Key. $client = new RedashApiClient\Client(REDASH_URL); $client->fetch(REDASH_QUERY_ID, REDASH_QUERY_API_KEY, false, [], function (array $row, array $columns) { $row = array_map(function ($column) use ($row) { return $row[$column]; }, $columns); echo implode("\t", $row) . PHP_EOL; }); // Fetch data with refresh option. // When you want to fetch data with refresh option, You have to use User API Key. $client = new RedashApiClient\Client(REDASH_URL, REDASH_USER_API_KEY); $client->fetch(REDASH_QUERY_ID, null, true, ['yearmonth' => '2023-07'], function (array $row, array $columns) { $row = array_map(function ($column) use ($row) { return $row[$column]; }, $columns); echo implode("\t", $row) . PHP_EOL; });
License
MIT
Author
统计信息
- 总下载量: 531
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-07-10