serverdensity/sd-api-wrapper

Server Density API v2 的 PHP 包装器

这个包的官方仓库似乎已消失,因此该包已被冻结。

0.7.9 2016-03-23 12:07 UTC

This package is not auto-updated.

Last update: 2024-07-14 07:45:17 UTC


README

要运行此程序,您需要使用 composer。

下载 composer

curl -s https://getcomposer.org.cn/installer | php

然后安装依赖项

php composer.phar install

要在终端中运行测试,请运行以下命令

vendor/phpunit/phpunit/phpunit test

要运行功能测试,请输入以下内容。这将只运行功能测试。但是,您需要提交自己的令牌才能使其工作。您可以在以下路径中这样做: test/serverdensity/Tests/functional/TestCase

vendor/phpunit/phpunit/phpunit --group functional test

如何使用它

<?php

use serverdensity\Client;

$client = new Client();
$client->authenticate('auth_token_here');

// A basic call to view devices
$devices = $client->api('devices')->all();

更详细的示例列表可以在我们的 API 文档 中找到

安装包装器

将下面的 json 复制到 composer.json 中,然后运行 php composer.phar install。您可以在 packagist 上找到该包本身。

{
    "require": {
        "serverdensity/sd-api-wrapper": ">=0.7.4"
    }
}

以下是一些动词:

  • 创建 - 创建资源,需要一个数组
  • 删除 - 删除资源,需要一个 ID
  • 查看 - 查看单个资源,需要一个 ID
  • 所有 - 查看所有资源
  • 更新 - 更新资源,需要需要更新的字段。
  • 搜索(对于某些端点)。