PHP code example of juanber84 / phpqueue
1. Go to this page and download the library: Download juanber84/phpqueue 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/ */
juanber84 / phpqueue example snippets
phpqueue\Publisher;
$data = array(
'name' => 'juan',
'surname' => 'berzal',
'email' => '[email protected]'
);
$messages =json_encode($data);
$publisher = new Publisher();
$publisher->setQueue('123456');
$publisher->setMessage($messages);
$publisher->setBlock_send(true); // synchronous send
//$publisher->setBlock_send(false); // asynchronous send
$response = $publisher->publish(); // empty response or array of fails
phpqueue\Consumer;
$consumer = new Consumer();
$consumer->setQueue('123456');
do {
echo $consumer->pickup();
// try it out
} while (true);