PHP code example of visual-craft / work-queue-bundle

1. Go to this page and download the library: Download visual-craft/work-queue-bundle 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/ */

    

visual-craft / work-queue-bundle example snippets




declare(strict_types=1);

namespace App\BackgroundJob\Worker;

use VisualCraft\WorkQueue\Worker\JobMetadata;
use VisualCraft\WorkQueue\Worker\WorkerInterface;

class TestWorker implements WorkerInterface
{
    public function work($payload, JobMetadata $metadata): void
    {
        //..
    }
}

//..
private QueueManager $queueManager;

public function __construct(QueueManager $queueManager)
{
    $this->queueManager = $queueManager;
}

//..
    $this->queueManager->add('mixed payload');
//..