1. Go to this page and download the library: Download fivesqrd/hive 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/ */
$job = Hive\Job::create(
['to' => '[email protected]', 'subject' => 'hello']
);
/* Run as soon as possible */
$result = $queue->add($job);
/* Receive 5 jobs and lock them for 300 seconds (FIFO) */
$jobs = $queue->receive(5, 300);
foreach ($jobs as $job) {
$payload = $job->payload();
/* Do the work */
$jobId = $job->id();
/* Mark job as done */
$queue->done($job);
}
/* Receive 5 jobs and lock them for 300 seconds (FILO) */
$jobs = $queue->receive(5, 300, false);
foreach ($jobs as $job) {
$subject = $job->payload('subject');
/* Do the work */
$jobId = $job->id();
/* Mark job as done */
$queue->done($job);
}