Skip to content

Instantly share code, notes, and snippets.

Created Jan 19, 2011

What would you like to do?
A demo of how to use amqphp
require 'amqp.php';
use amqp_091 as amqp;
use amqp_091\protocol;
use amqp_091\wire;
$params = array('username' => 'testing',
'userpass' => 'letmein',
'vhost' => 'robin',
'exchange' => 'unit-test-basic',
'socketImpl' => '\amqp_091\Socket',
'socketParams' => array(
'host' => 'localhost',
'port' => '5672'));
$c = new amqp\Connection($params);
$chan = $c->getChannel();
$msg = $chan->basic('publish', array('content-type' => 'text/plain',
'content-encoding' => 'UTF-8',
'routing-key' => '',
'mandatory' => false,
'immediate' => false,
'exchange' => 'unit-test-basic'), 'This is the message content');
echo "Done!\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.