nc / faye-client
用于与 faye 服务器交互的 PHP 客户端
v1.1.1
2014-06-10 06:11 UTC
Requires
- php: >=5.3.0
Requires (Dev)
- atoum/atoum: dev-master
- guzzle/guzzle: ~3.0
Suggests
- guzzle/guzzle: ~3.0
This package is not auto-updated.
Last update: 2024-09-23 13:52:27 UTC
README
PHP 5.3+ 库,用于向 faye 服务器推送消息。
安装
通过 composer
{ "require": { "nc/faye-client": "~1.0", # if you want to use guzzle adapter "guzzle/guzzle": "~3.0" } }
用法
$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"));
客户端发送方法文档
/** * 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());
JSON 发送适配器
* CurlAdapter : `Nc\FayeClient\Adapter\CurlAdapter`
* GuzzleAdapter : `Nc\FayeClient\Adapter\GuzzleAdapter`
运行测试
php vendor/bin/atoum -D tests/ -bf tests/bootstrap.php