duellsy/phpflow

PHP Library for Flowdock API usage

1.0.1 2013-08-20 15:56 UTC

This package is auto-updated.

Last update: 2024-04-23 14:07:45 UTC


README

PHP Library for Flowdock API use

Installation

Install composer in the project

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

Then insert composer autoload requirement line in your project

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

Usage

Push message

Write message to CHAT

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

Write message to TEAM INBOX

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

Users

Get all users

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

Get flow users

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

Get a user

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

Flows

Get all flows

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

Streaming

Stream message from a flow

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

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

Stream message from flows

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);
}