nesquick/trafficcophp

PHP 客户端用于 Traffic Cop 消息队列。

v0.2 2012-04-07 18:51 UTC

This package is not auto-updated.

Last update: 2024-09-20 14:24:05 UTC


README

Build Status

这是 TrafficCop 的官方 PHP 客户端。它提供了一个非常简单的客户端用于基本使用,同时也提供了非常面向对象的风格使用。只需查看示例即可。

安装

应通过 composer 进行安装。

{
    "require": {
        "nesQuick/TrafficCophp": "dev-master"
    }
}

示例

您应该查看示例文件夹。一个简单的使用示例可能如下所示

<?php

require __DIR__ . '/../vendor/.composer/autoload.php';

use TrafficCophp\Client;

$client = new Client('127.0.0.1', 3542);
$client->publish('channel_two', 'A little test message from php client example');

$client->subscribe('channel_one', 'channel_two', 'channel_three');

while (true) {
	$client->receive(function($channel, $message) {
		printf('Got message "%s" on %s', $message, $channel);
	});
}

待办事项

  • 编写 PHP 文档
  • 清理使用语句
  • 重构频道收集

许可证

遵循 MIT 许可证。