nc/faye-client

Php client for interacting with faye server

v1.1.1 2014-06-10 06:11 UTC

This package is not auto-updated.

Last update: 2024-11-18 14:42:36 UTC


README

Build Status

PHP 5.3+ library to push message to a faye server.

http://faye.jcoglan.com/

Instalation

via composer

{
    "require": {
        "nc/faye-client": "~1.0",
        # if you want to use guzzle adapter
        "guzzle/guzzle": "~3.0"
    }
}

Usage

$adapter = new \Nc\FayeClient\Adapter\CurlAdapter();

$client = new \Nc\FayeClient\Client($adapter, 'http://127.0.0.1/faye');

$client->send("/channel1", array("name" => "foo"), array("token" => "456454sdqd"));

Client Send method documentation

/**
 * Send message
 * @param  string $channel message channel
 * @param  array  $data    Data to send
 * @param  array  $ext     Extra data
 */
public function send($channel, $data = array(), $ext = array());

Adapter to post JSON

* CurlAdapter   : `Nc\FayeClient\Adapter\CurlAdapter`
* GuzzleAdapter : `Nc\FayeClient\Adapter\GuzzleAdapter`

Run test

php vendor/bin/atoum -D tests/ -bf tests/bootstrap.php