silinternational / hipchat-php-client
此软件包已被废弃且不再维护。未建议替代包。
PHP 客户端库,用于与 HipChat V2 API 交互
0.1.1
2016-08-11 20:25 UTC
Requires
- php: >=5.4.0
- guzzlehttp/guzzle: ^5.3.1
- guzzlehttp/guzzle-services: *
- guzzlehttp/log-subscriber: *
- guzzlehttp/retry-subscriber: *
Requires (Dev)
- phpunit/phpunit: ~4.0
This package is auto-updated.
Last update: 2020-12-23 17:05:32 UTC
README
hipchat-php-client
PHP 客户端库,用于与 HipChat v2 API 交互。
我们将逐步构建此客户端,因为我们需要该功能。最初我们只需要它来添加用户到组。
此客户端建立在 Guzzle PHP HTTP 客户端之上。Guzzle 提供了一种简单的方法来创建 API 客户端,通过以 Swagger 格式描述 API,无需自己实现每个方法。因此,支持更多 HipChat API 相对简单。如果您想提交一个 pull 请求来添加另一个功能,请这样做。如果您不知道如何操作,请向我们询问,我们可能会为您添加它。
HipChat API 文档
https://www.hipchat.com/docs/apiv2
HipChat API 认证
HipChat 使用 OAuth 令牌进行认证,您可以通过访问 https://silintl.hipchat.com/account/api 创建令牌。
安装
使用 Composer 安装很简单。将 "silinternational/hipchat-php-client": "dev-master"
添加到您的 composer.json
文件中,并更新。
用法
示例
<?php use HipChat\UserClient; $client = new UserClient([ ]); $user = $client->createUser([ 'name' => 'Test User', 'mention_name' => 'TestUser', 'email' => 'testuser@testdomain.com', ]); var_dump($user); array(4) { 'entity' => array(5) { 'id' => int(9876543) 'links' => array(1) { 'self' => string(42) "https => //api.hipchat.com/v2/user/9876543" } 'mention_name' => string(8) "TestUser" 'name' => string(9) "Test User" 'version' => string(8) "ZV8L9NOQ" } 'id' => int(9876543) 'links' => array(1) { 'self' => string(42) "https => //api.hipchat.com/v2/user/9876543" } 'password' => string(12) "DT5qi1ewkFw8" }
Guzzle 服务客户端说明
- 使用 Guzzle Web Services 开发 API 客户端的教程: http://www.phillipshipley.com/2015/04/creating-a-php-nexmo-api-client-using-guzzle-web-service-client-part-1/
- Jeremy Lindblom 的演示: https://speakerdeck.com/jeremeamia/building-web-service-clients-with-guzzle-1
- Jeremy Lindblom 的示例: https://github.com/jeremeamia/sunshinephp-guzzle-examples
- 源代码注释中的参数文档: https://github.com/guzzle/guzzle-services/blob/master/src/Parameter.php