Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 

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.

About

PHP Client for TrafficCop

Resources

Packages

No packages published

Languages