Skip to content

Instantly share code, notes, and snippets.

@jericrealubit
Last active September 13, 2017 21:36
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 jericrealubit/3f8c9fc46a89cdbfdee41700819a5653 to your computer and use it in GitHub Desktop.
Save jericrealubit/3f8c9fc46a89cdbfdee41700819a5653 to your computer and use it in GitHub Desktop.
<?php
require_once __DIR__ . '/vendor/autoload.php';
use PhpAmqpLib\Connection\AMQPStreamConnection;
use PhpAmqpLib\Message\AMQPMessage;
$connection = new AMQPStreamConnection('jeric.devel.nz', 5672, 'guest', 'guest');
$channel = $connection->channel();
$channel->queue_declare('hello', false, false, false, false);
$msg = new AMQPMessage('Hello World!');
$channel->basic_publish($msg, '', 'hello');
echo " [x] Sent 'Hello World!'\n";
$channel->close();
$connection->close();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment