diff --git a/README.md b/README.md index 12142ab..a605a48 100644 --- a/README.md +++ b/README.md @@ -25,22 +25,26 @@ Each example has a README.md file that shows how to execute it. All the examples For example, to publish message to RabbitMQ is as simple as this: - $producer = new Thumper\Producer($connection); - $producer->setExchangeOptions(array('name' => 'hello-exchange', 'type' => 'direct')); - $producer->publish($argv[1]); +```php +$producer = new Thumper\Producer($connection); +$producer->setExchangeOptions(array('name' => 'hello-exchange', 'type' => 'direct')); +$producer->publish($argv[1]); +``` And then to consume them on the other side of the wire: - $myConsumer = function($msg) - { - echo $msg, "\n"; - }; - - $consumer = new Thumper\Consumer($connection); - $consumer->setExchangeOptions(array('name' => 'hello-exchange', 'type' => 'direct')); - $consumer->setQueueOptions(array('name' => 'hello-queue')); - $consumer->setCallback($myConsumer); //myConsumer could be any valid PHP callback - $consumer->consume(5); //5 is the number of messages to consume. +```php +$myConsumer = function($msg) +{ + echo $msg, "\n"; +}; + +$consumer = new Thumper\Consumer($connection); +$consumer->setExchangeOptions(array('name' => 'hello-exchange', 'type' => 'direct')); +$consumer->setQueueOptions(array('name' => 'hello-queue')); +$consumer->setCallback($myConsumer); //myConsumer could be any valid PHP callback +$consumer->consume(5); //5 is the number of messages to consume. +``` ### Queue Server