PHP code example of s12v / phpque

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

    

s12v / phpque example snippets




use Phpque\Client;
use Phpque\Connection\ConnectionException;

://127.0.0.1:7711', 'tcp://127.0.0.1:7712']);

    // ... or to a single server
    $client = new Client('tcp://127.0.0.1:7711');
} catch (ConnectionException $e) {
    // Handle connection errors
    throw $e;
}

// Add a job with payload "some data" and timeout 1 sec
$client->addJob('test_queue', 'some data', 1000);

// Get a job from the queue
$job = $client->getJob(array('test_queue'));

// Acknowledge the job
$client->ackJob($job);