PHP code example of linio / queue

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

    

linio / queue example snippets




use Linio\Component\Queue\QueueService;
use Linio\Component\Queue\Adapter;

$queue = new QueueService();
$queue->setAdapter(new Adapter\RabbitAdapter([
    'host' => 'localhost',
    'port' => 5672,
    'username' => 'guest',
    'password' => 'guest',
    'vhost' => '/'
]));




use Linio\Component\Queue\Job;

class HelloWorldJob extends Job
{
    public function perform()
    {
        echo sprintf("Hello %s!\n", $this->payload);
        $this->finish();
    }
}




use Linio\Component\Queue\QueueService;

$queue = new QueueService();
$queue->add(new HelloWorldJob('John')); // "John" is the payload




use Linio\Component\Queue\QueueService;

$queue = new QueueService();
$queue->perform(new HelloWorldJob());