markdunphy / ears
There is no license information available for the latest version (0.1.0) of this package.
A PHP RabbitMQ library using php-amqplib
0.1.0
2014-07-23 03:37 UTC
Requires
- videlalvaro/php-amqplib: ~2.4.0
Requires (Dev)
- phpunit/phpunit: 4.1.*
This package is not auto-updated.
Last update: 2024-11-19 03:28:00 UTC
README
A PHP RabbitMQ library using php-amqplib
##Basic Usage
These examples use the default localhost
RabbitMQ server created when you install it. For production use (and you're crazy if you're doing this), you should configure a markdunphy\Ears\Connection
object to pass in as the first argument to the markdunphy\Ears\Ears
constructor.
Below is a simple hello world
demonstration. Run the consumer code in one terminal tab and the publisher in another to watch things happen.
#####Configuring a Consumer
use \markdunphy\Ears\Ears; $consumer = ( new Ears )->getConsumer(); $consumer->consumeBasic( 'hello', function( $message ) { echo $message->body . "\n"; } );
#####Configuring a Publisher
use \markdunphy\Ears\Ears; $ears = new Ears( null, 'hello' ); $publisher = $ears->getPublisher(); $publisher->sendBasic( 'Hello world' );