PHPackages                             wilddogserver/huang - 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. wilddogserver/huang

ActivePackage

wilddogserver/huang
===================

2.0.0(7y ago)010MITPHPPHP &gt;=5.3.0

Since Feb 20Pushed 7y agoCompare

[ Source](https://github.com/huangjingxuanaa/wilddog-server)[ Packagist](https://packagist.org/packages/wilddogserver/huang)[ Docs](https://github.com/huangjingxuanaa/wilddog-server)[ RSS](/packages/wilddogserver-huang/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (3)Used By (0)

Wilddog PHP Client
==================

[](#wilddog-php-client)

基于 [Wilddog REST API](https://z.wilddog.com/rest/quickstart).

### 示例

[](#示例)

```
const DEFAULT_URL = 'https://testing.wilddogio.com/';
const DEFAULT_TOKEN = 'xVUeUTLjTye5cS4ugiG6C5BStV0deHgfsCi6SG6W';
const DEFAULT_PATH = '/wilddog/example';

$wilddog = new \Wilddog\WilddogLib(DEFAULT_URL, DEFAULT_TOKEN);

// --- storing an array ---
$test = array(
    "foo" => "bar",
    "i_love" => "lamp",
    "id" => 42
);
$dateTime = new DateTime();
$wilddog->set(DEFAULT_PATH . '/' . $dateTime->format('c'), $test);

// --- storing a string ---
$wilddog->set(DEFAULT_PATH . '/name/contact001', "John Doe");

// --- reading the stored string ---
$name = $wilddog->get(DEFAULT_PATH . '/name/contact001');
```

### Token生成

[](#token生成)

Token用于标识用户身份，结合 [规则表达式](https://z.wilddog.com/rule/quickstart) 做数据读写权限的控制。可以使用超级密钥本身做为token，这样的终端将获得管理员权限，读写数据操作不受规则表达式的限制。也可以使用超级密钥进行签名，自行生成标准jwt格式的token。

token格式的文档参见：。

php版token生成工具：[wilddog-token-generator-php](https://github.com/WildDogTeam/wilddog-token-generator-php)。

### API列表

[](#api列表)

```
// -- Wilddog API
//注意: 所有数据API操作需要判断返回是否成功
$wilddog->set($path, $value);   // 存储数据
$value = $wilddog->get($path);  // 读取数据
$wilddog->delete($path);        // 删除数据
$wilddog->update($path, $data); // 更新数据
$wilddog->push($path, $data);   // push数据

// -- Wilddog PHP Library API
$wilddog->setToken($token);     // 设置用户token
$wilddog->setBaseURI($uri);     // 设置uri路径
$wilddog->setTimeOut($seconds); // 设置超时时间
```

详细的Rest API接口描述，请参考 [Wilddog REST API 文档](https://z.wilddog.com/rest/quickstart).

### Wilddog PHP Stub

[](#wilddog-php-stub)

Wilddog PHP Stub使得我们在集成phpunit做单元测试的时候，无需真正和Wilddog云端交互，它相当于一个mock。

要使用wilddogStub进行测试，需要让wilddog引用对象作为参数被传递进去，以便于在测试的时候可以很方便的替换为wilddogStub。

例如，如果代码是这样的：

```
public function setWilddogValue($path, $value) {
  $wilddog = new Wilddog('https://testing.wilddogio.com', 'xVUeUTLjTye5cS4ugiG6C5BStV0deHgfsCi6SG6W');
  $wilddog->set($path, $value);
}
```

可以改为这样：

```
public function setWilddogValue($path, $value, $wilddog) {
    $result = $wilddog->set($path, $value)
    if ($result == null && $value != null) {
        //若为null 则需要判断是否出现了异常
        //只有set的$value为null时 set($path,$value)返回null
        //其他情况为请求异常 需要用户进行判断重试
    }
}
```

进行phpunit单元测试：

```

```

### 单元测试

[](#单元测试)

单元测试代码在/test目录下。测试运行方式如下：

```
$ phpunit test/wilddogTest.php
```

```
$ phpunit test/wilddogStubTest.php
```

### License

[](#license)

MIT

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

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 ~0 days

Total

2

Last Release

2641d ago

Major Versions

1.0.0 → 2.0.02019-02-20

### Community

Maintainers

![](https://www.gravatar.com/avatar/ab07851543ed59f4834394a0bdb612bb28ff3fefface19a6fa80d03b6dbcfebf?d=identicon)[huangjingxuanaa](/maintainers/huangjingxuanaa)

---

Tags

Wilddog

### Embed Badge

![Health badge](/badges/wilddogserver-huang/health.svg)

```
[![Health](https://phpackages.com/badges/wilddogserver-huang/health.svg)](https://phpackages.com/packages/wilddogserver-huang)
```

PHPackages © 2026

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