PHP code example of dominionenterprises / mongo-queue-php

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

    

dominionenterprises / mongo-queue-php example snippets


use TraderInteractive\Mongo\Queue;

$queue = new Queue('mongodb://localhost', 'queues', 'queue');
$queue->send(new Message());
$messages = $queue->get([], ['runningResetDuration' => 60]);
foreach ($messages as $message) {
    // Do something with message

    $queue->ack($message);
}