PHPackages                             yurunsoft/tdengine-restful-connector - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. yurunsoft/tdengine-restful-connector

ActiveLibrary[HTTP &amp; Networking](/categories/http)

yurunsoft/tdengine-restful-connector
====================================

v2.0.2(2y ago)2010.0k↓35.7%8[2 issues](https://github.com/Yurunsoft/tdengine-restful-connector/issues)2MITPHPPHP &gt;=7.1

Since Jul 15Pushed 2y ago1 watchersCompare

[ Source](https://github.com/Yurunsoft/tdengine-restful-connector)[ Packagist](https://packagist.org/packages/yurunsoft/tdengine-restful-connector)[ RSS](/packages/yurunsoft-tdengine-restful-connector/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (13)Used By (2)

tdengine-restful-connector
==========================

[](#tdengine-restful-connector)

[![Latest Version](https://camo.githubusercontent.com/550728a6de0dc2a6aa4fd36b89ee62d703b545e85018def81cdbce31f552f78f/68747470733a2f2f706f7365722e707567782e6f72672f797572756e736f66742f7464656e67696e652d7265737466756c2d636f6e6e6563746f722f762f737461626c65)](https://packagist.org/packages/yurunsoft/tdengine-restful-connector)[![GitHub Workflow Status (branch)](https://camo.githubusercontent.com/5964a8a8c4e5b6a1c401fc07ea20c10562bf6f25bf4ca94abb3858ba6429b59d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f597572756e736f66742f7464656e67696e652d7265737466756c2d636f6e6e6563746f722f63692f6d6173746572)](https://camo.githubusercontent.com/5964a8a8c4e5b6a1c401fc07ea20c10562bf6f25bf4ca94abb3858ba6429b59d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f597572756e736f66742f7464656e67696e652d7265737466756c2d636f6e6e6563746f722f63692f6d6173746572)[![Php Version](https://camo.githubusercontent.com/315f5c30e505b9ccc4178451bbd34c2ba5d281d1fa3267304053ed19ab634125/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d2533453d372e312d627269676874677265656e2e737667)](https://secure.php.net/)[![License](https://camo.githubusercontent.com/b4cc8a4560d049314decaa01b638187683f410fba640f81dc783697c3eb67baa/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f597572756e736f66742f7464656e67696e652d7265737466756c2d636f6e6e6563746f722e737667)](https://github.com/Yurunsoft/tdengine-restful-connector/blob/master/LICENSE)

简介
--

[](#简介)

封装了 [TDEngine](https://github.com/taosdata/TDengine) 的 RESTful 接口，可以使用 PHP 轻松地操作 TDEngine 的数据插入和查询了。

此项目支持在 PHP &gt;= 7.1 的项目中使用。

支持在 ThinkPHP、Laravel、[Swoole](https://github.com/swoole/swoole-src)、[imi](https://github.com/imiphp/imi) 等项目中使用

在 Swoole 环境中支持协程化，不会阻塞！

技术支持 QQ 群: 17916227[![点击加群](https://camo.githubusercontent.com/75b53e353bb9e5064662e185a6d39f4bb88c4e45bd3a1240ddf599525edb6afa/68747470733a2f2f7075622e69647171696d672e636f6d2f7770612f696d616765732f67726f75702e706e67 "点击加群")](https://jq.qq.com/?_wv=1027&k=5wXf4Zq)，如有问题可以及时解答和修复。

安装
--

[](#安装)

`composer require yurunsoft/tdengine-restful-connector`

使用
--

[](#使用)

**使用连接管理器：**

```
// 增加名称为 test 的连接配置
\Yurun\TDEngine\TDEngineManager::setClientConfig('test', new \Yurun\TDEngine\ClientConfig([
    // 'host'            => '127.0.0.1',
    // 'hostName'        => '',
    // 'port'            => 6041,
    // 'user'            => 'root',
    // 'password'        => 'taosdata',
    // 'db'              => 'database'
    // 'ssl'             => false,
    // 'timestampFormat' => \Yurun\TDEngine\Constants\TimeStampFormat::LOCAL_STRING, // 此配置 TDengine 3.0 下失效，统一返回格式为：2022-11-25T05:41:04.690Z
    // 'keepAlive'       => true,
    // 'version'         => '3', // TDengine 版本
    // 'timezone'        => 'UTC', // TDengine >= 3.0 时支持，可选参数，指定返回时间的时区
]));
// 设置默认数据库为test
\Yurun\TDEngine\TDEngineManager::setDefaultClientName('test');
// 获取客户端对象（\Yurun\TDEngine\Client）
$client = \Yurun\TDEngine\TDEngineManager::getClient();
```

**直接 new 客户端：**

```
$client = new \Yurun\TDEngine\Client(new \Yurun\TDEngine\ClientConfig([
    // 'host'            => '127.0.0.1',
    // 'hostName'        => '',
    // 'port'            => 6041,
    // 'user'            => 'root',
    // 'password'        => 'taosdata',
    // 'db'              => 'database'
    // 'ssl'             => false,
    // 'timestampFormat' => \Yurun\TDEngine\Constants\TimeStampFormat::LOCAL_STRING, // 此配置 TDengine 3.0 下失效，统一返回格式为：2022-11-25T05:41:04.690Z
    // 'keepAlive'       => true,
    // 'version'         => '3', // TDengine 版本
    // 'timezone'        => 'UTC', // TDengine >= 3.0 时支持，可选参数，指定返回时间的时区
]));

// 通过 sql 方法执行 sql 语句
var_dump($client->sql('create database if not exists db_test'));
var_dump($client->sql('show databases'));
var_dump($client->sql('create table if not exists db_test.tb (ts timestamp, temperature int, humidity float)'));
var_dump($client->sql(sprintf('insert into db_test.tb values(%s,%s,%s)', time() * 1000, mt_rand(), mt_rand() / mt_rand())));

$result = $client->sql('select * from db_test.tb');

$result->getResponse(); // 获取接口原始返回数据

// 获取列数据
foreach ($result->getColumns() as $column)
{
    $column->getName(); // 列名
    $column->getType(); // 列类型值
    $column->getTypeName(); // 列类型名称
    $column->getLength(); // 类型长度
}

// 获取数据
foreach ($result->getData() as $row)
{
    echo $row['列名']; // 经过处理，可以直接使用列名获取指定列数据
}

$result->getStatus(); // 告知操作结果是成功还是失败；同接口返回格式。仅 TDengine 2.x 有用。

$result->getHead(); // 表的定义，如果不返回结果集，则仅有一列“affected_rows”。（从 2.0.17 版本开始，建议不要依赖 head 返回值来判断数据列类型，而推荐使用 column_meta。在未来版本中，有可能会从返回值中去掉 head 这一项。）；同接口返回格式

$result->getRows(); // 表明总共多少行数据；同接口返回格式
```

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity35

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 95.2% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~76 days

Recently: every ~81 days

Total

12

Last Release

923d ago

Major Versions

v1.0.6 → v2.0.02022-12-09

v1.0.7 → v2.0.22023-11-01

PHP version history (2 changes)v1.0.0PHP &gt;=7.0

v1.0.3PHP &gt;=7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/6f917bb42280d114c53cebadc2942a13ee03abe14971089f88895e266d637169?d=identicon)[Yurunsoft](/maintainers/Yurunsoft)

---

Top Contributors

[![Yurunsoft](https://avatars.githubusercontent.com/u/20104656?v=4)](https://github.com/Yurunsoft "Yurunsoft (20 commits)")[![onlyshow](https://avatars.githubusercontent.com/u/12505832?v=4)](https://github.com/onlyshow "onlyshow (1 commits)")

---

Tags

phptdengine

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/yurunsoft-tdengine-restful-connector/health.svg)

```
[![Health](https://phpackages.com/badges/yurunsoft-tdengine-restful-connector/health.svg)](https://phpackages.com/packages/yurunsoft-tdengine-restful-connector)
```

###  Alternatives

[friendsofsymfony/rest-bundle

This Bundle provides various tools to rapidly develop RESTful API's with Symfony

2.8k73.3M319](/packages/friendsofsymfony-rest-bundle)[php-http/discovery

Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations

1.3k309.5M1.2k](/packages/php-http-discovery)[nyholm/psr7

A fast PHP7 implementation of PSR-7

1.3k235.4M2.4k](/packages/nyholm-psr7)[spatie/crawler

Crawl all internal links found on a website

2.8k16.3M52](/packages/spatie-crawler)[react/http

Event-driven, streaming HTTP client and server implementation for ReactPHP

78126.4M414](/packages/react-http)[php-http/curl-client

PSR-18 and HTTPlug Async client with cURL

48247.0M384](/packages/php-http-curl-client)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
