PHP code example of markdunphy / ears

1. Go to this page and download the library: Download markdunphy/ears 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/ */

    

markdunphy / ears example snippets


use \markdunphy\Ears\Ears;

$consumer = ( new Ears )->getConsumer();

$consumer->consumeBasic( 'hello', function( $message ) {
  echo $message->body . "\n";
} );

use \markdunphy\Ears\Ears;

$ears = new Ears( null, 'hello' );

$publisher = $ears->getPublisher();

$publisher->sendBasic( 'Hello world' );