Skip to content

Instantly share code, notes, and snippets.

@jakubkulhan
Created April 23, 2015 18:38
Show Gist options
  • Select an option

  • Save jakubkulhan/f36776e9e112a423b8ba to your computer and use it in GitHub Desktop.

Select an option

Save jakubkulhan/f36776e9e112a423b8ba to your computer and use it in GitHub Desktop.
BunnyPHP Async Example
<?php
namespace Bunny\Example;
use Bunny\Async\Client;
use Bunny\Channel;
use React\EventLoop\Factory;
$loop = Factory::create();
$c = new Client($loop, [
"host" => "127.0.0.1",
"port" => 5672,
"user" => "guest",
"password" => "guest",
"vhost" => "/",
]);
$c->connect()->then(function (Client $c) {
return $c->channel();
})->then(function (Channel $ch) {
// ... work channel ...
// $ch->exchangeDeclare(...)
// $ch->publish(...)
});
$loop->run();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment