PHP code example of dataprocessors / amqp-async

1. Go to this page and download the library: Download dataprocessors/amqp-async library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

dataprocessors / amqp-async example snippets



s Demo {

  public function go() {
    $conn = new DataProcessors\AMQP\AMQPConnection();
    yield $conn->connect('127.0.0.1', 5672, 'guest', 'guest');
    $channel = yield $conn->channel();
    yield $channel->basic_consume('test', '', false, false, false, false,
      function($msg) {
        echo "Got a message\n";
      }
    );
  }

}

$demo = new Demo();
$coroutine = new Icicle\Coroutine\Coroutine($demo->go());
Icicle\Loop\run();