PHP code example of fordnox / php-queue-manager

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

    

fordnox / php-queue-manager example snippets


$dbh = new PDO('sqlite:queue.sqlite');
$dbh->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION );
$dbh->setAttribute(\PDO::ATTR_DEFAULT_FETCH_MODE, \PDO::FETCH_ASSOC);
$dbh->exec($structure);


$message = new \QueueExample\Dummy();

$manager = new \Queue\Manager();
$manager->setPdo($dbh);
$manager->addMessageToQueue($message, 'AmazonEmailsQueue');

// Usually this call should be executed via cron or some other worker
$amazonEmails = $manager->getQueue('AmazonEmailsQueue');
$amazonEmails->execute();