PHP code example of romeoz / rock-mq
1. Go to this page and download the library: Download romeoz/rock-mq 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/ */
romeoz / rock-mq example snippets
use rock\mq\RabbitQueue;
$rabbit = new RabbitQueue();
$rabbit->send('test'); // result: "Hi! I am server: test"
// or background
$rabbit->sendBackground('test');
use rock\mq\RabbitQueue;
$rabbit = new RabbitQueue();
$rabbit->blocking = false;
$rabbit->type = 'direct';
$rabbit->exchange = 'direct_test';
$rabbit->subscribe('foo'); // result: "Hi! I am server: foo"
php tests/data/mq/rabbit/simple_server.php &
php tests/data/mq/rabbit/pub_server.php &