This is a PHP wrapper for interacting with the Faye server.
This is a PHP library for interacting with the Faye server. Faye is a publish-subscribe messaging system based on the Bayeux protocol., (*1)
You can get the Faye PHP library via composer package. See https://packagist.org/packages/anchu/faye-php, (*2)
Or you can clone or download the library files., (*3)
Use the Faye server configurations to create a new Faye instance., (*4)
$host = 'YOUR_FAYE_HOST'; $mountPoint = 'YOUR_FAYE_MOUNT_POINT'; $port = 'YOUR_FAYE_PORT'; //by default this will be 8000 $faye = new Faye($host, $mountPoint, $port);
To trigger a message on a channel use the trigger function., (*5)
$faye->trigger( 'my-channel', 'my_event', 'hello world' );
Objects are automatically converted to JSON format:, (*6)
$array['status'] = 'success'; $array['action'] = 'continue'; $faye->trigger('my_channel', 'my_event', $array);
The output of this will be:, (*7)
"{'event': 'my_event', 'message': {'status': 'success', 'action': 'continue'}}"
Copyright 2013, Harish A. Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php, (*8)