Skip to content

DataProcessors/amqp-async

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

amqp-async

Build Status LGPL-2.1 License

amqp-async is an implementation of the AMQP 0.9.1 protocol for PHP designed to work with Icicle.

Potentially supporting Amp in the future.

Requirements
  • PHP 7.0+
Installation

The recommended way to install amqp-async is with the Composer package manager. (See the Composer installation guide for information on installing and using Composer.)

Run the following command to use the library in your project:

composer require dataprocessors/amqp-async

You can also manually edit composer.json to add amqp-async as a project requirement.

// composer.json
{
    "require": {
        "dataprocessors/amqp-async": "1.0.*"
    }
}

Example

<?php
require_once "vendor/autoload.php";

class 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();

Credits

amqp-async is based on php-amqplib

About

Async AMQP 0.9.1 client for PHP

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages