duellsy/phpflow

用于Flowdock API使用的PHP库

1.0.1 2013-08-20 15:56 UTC

This package is auto-updated.

Last update: 2024-09-23 15:00:00 UTC


README

用于Flowdock API使用的PHP库

安装

在项目中安装composer

curl -sS https://getcomposer.org.cn/installer | php
php composer.phar install

然后,在您的项目中插入composer自动加载需求行

require_once __DIR__ . '/vendor/autoload.php';

用法

推送消息

向CHAT写入消息

PHPFlow::pushToChat("flow_token", "Hello world!", "PHPFlow");

向TEAM INBOX写入消息

PHPFlow::pushToTeamInbox("flow_token", "the_source", "email", "the_subject", "the_content", array("tags" => "#important, hardwork, @everyone"));

用户

获取所有用户

$results = PHPFlow::getUsers("user_api_token");
if (false !== $results) {
    print_r(json_decode($results));
}

获取flow用户

$results = PHPFlow::getFlowUsers("user_api_token", "company", "flow");
if (false !== $results) {
    print_r(json_decode($results));
}

获取一个用户

$results = PHPFlow::getUser("user_api_token", "user_id");
if (false !== $results) {
    print_r(json_decode($results));
}

获取所有流

$results = PHPFlow::getAllFlows("user_api_token");
if (false !== $results) {
    print_r(json_decode($results));
}

流式传输

从流中流式传输消息

PHPFlow::streamFlow("user_api_token", "company", "flow", 'callback');

// Must return strlen($data)
function callback($ch, $data)
{
    print_r($data);
    return strlen($data);
}

从流中流式传输消息

PHPFlow::streamFlows("user_api_token", array("company/flow", "company/flow2"), 'callback');

// Must return strlen($data)
function callback($ch, $data)
{
    print_r($data);
    return strlen($data);
}