PHP Client for TrafficCop
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples
src/TrafficCophp
tests/TrafficCophp/Tests
.gitignore
.travis.yml
README.md
composer.json
composer.lock
phpunit.xml.dist

README.md

Official PHP client for TrafficCop

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.