octivi/php-cephclient

该软件包已被弃用且不再维护。未建议替代软件包。

用于与 Ceph 的 REST API 通信的 PHP 库

dev-master 2014-08-07 08:14 UTC

This package is not auto-updated.

Last update: 2021-03-05 21:23:38 UTC


README

php-cephclient 是一个用于与 Ceph 的 REST API 通信的 PHP 库。

这是一个正在进行中的项目。

关于

CurlClient

CurlClient 类负责通过 HTTP 向 API 发送调用并处理响应。它支持 JSON、XML、纯文本或二进制查询。

CephClient

CephClient 类提供与 API 通信的辅助函数。CallWrapper 使用 CephClient。

您可以直接调用客户端,没有任何限制。

开发、反馈、错误

贡献者

感谢 David Moreau Simard,他是 python-cephclient 的作者,这启发了我们创建 php-cephclient 库。

想要贡献?请随意发送拉取请求!

有问题、错误、特性想法?我们使用 github 问题跟踪器 来管理它们。

如何使用

安装

通过 composer 安装包:

php composer.phar require octivi/php-cephclient:*

用法

实例化 CephClient

use Octivi\CephClient\Client\CephClient;

$url = 'http://10.20.51.201:5000/api/v0.1/';
$cephClient = new CephClient($url);

可选的认证

use Octivi\CephClient\Client\CephClient;

$url = 'http://10.20.51.201:5000/api/v0.1/';
$cephClient = new CephClient($url);
$cephClient->useAuth('name', 'password');

执行您的请求。

$response = $cephClient->getRoot()->fsId();

响应示例

object(stdClass)[91]
  public 'status' => string 'OK' (length=2)
  public 'output' => 
    object(stdClass)[109]
      public 'fsid' => string '60d98352-115b-4ca1-a51b-414d98492168' (length=36)

您可以通过将调试参数设置为 true 来设置 CephClient 返回 json 响应

new CephClient($url, true);

响应示例

{
    "status": "OK",
    "output": {
        "fsid": "d5252e7d-75bc-4083-85ed-fe51fa83f62b"
    }
}

可选功能:在获取您的响应后,您可以获取有关调用的信息

$cephClient->root->fsId();
$cephClient->getInfo();

信息示例

array (size=26)
    'url' => string 'http://10.20.51.201:5000/api/v0.1/fsid' (length=38)
    'content_type' => string 'application/json' (length=16)
    'http_code' => int 200
    'header_size' => int 145
    'request_size' => int 148
    'filetime' => int -1
    'ssl_verify_result' => int 0
    'redirect_count' => int 0
    'total_time' => float 0.015
    'namelookup_time' => float 0
    'connect_time' => float 0
    'pretransfer_time' => float 0
    'size_upload' => float 0
    'size_download' => float 76
    'speed_download' => float 5066
    'speed_upload' => float 0
    'download_content_length' => float 76
    'upload_content_length' => float 0
    'starttransfer_time' => float 0.015
    'redirect_time' => float 0
    'certinfo' => 
      array (size=0)
        empty
    'primary_ip' => string '10.20.51.201' (length=12)
    'primary_port' => int 5000
    'local_ip' => string '10.20.52.231' (length=12)
    'local_port' => int 52062
    'redirect_url' => string '' (length=0)

阅读更多: cephClient 调用组和函数

发行说明

0.1.0

  • php-cephclient 的第一个公共版本