Skip to content

Instantly share code, notes, and snippets.

Created January 19, 2011 19:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/786716 to your computer and use it in GitHub Desktop.
Save anonymous/786716 to your computer and use it in GitHub Desktop.
A demo of how to use amqphp
<?php
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);
$c->connect();
$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');
$chan->invoke($msg);
echo "Done!\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment