nesquick/trafficcophp

PHP Client for Traffic Cop messsage queue.

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

This package is not auto-updated.

Last update: 2024-12-13 15:25:39 UTC


README

Build Status

This is the official PHP client for TrafficCop. It provides a very simple client for basic usage but offers also very OO-Style usage. Just see examples for that.

Install

Installation should be done via composer.

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

Example

You should have a look into the examples folder. A simple usage example could look like this

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

ToDo's

  • write php doc
  • cleanup use statements
  • refactor channel collection

License

Licensed under the MIT license.