PHP code example of forseti / simple-queue

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

    

forseti / simple-queue example snippets



dis = new Predis\Client();
$queue = (new \Forseti\SimpleQueue\Connection($predis))->queue('queuename');

$job = new \Forseti\SimpleQueue\Job(['data' => 'value']);
$queue->push($job);


dis = new Predis\Client();
$connection = new \Forseti\SimpleQueue\Connection($predis);
$queue = $connection->queue('queuename');

while($job = $queue->pull()) {
    print_r($job);
    sleep(2);

    //remove da fila
    $queue->processed($job);
}