1. Go to this page and download the library: Download antidot-fw/message-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/ */
declare(strict_types=1);
use Psr\Container\ContainerInterface;
use Antidot\Queue\Producer;
/** @var ContainerInterface $container */
/** @var Producer $producer */
$producer = $container->get(Producer::class);
// Send String Job of type "some_message_type" to "default" queue.
$job1 = Job::create('default', 'some_message_type', 'Hello world!!');
$producer->enqueue($job1);
// Send Array Job of type "other_message_type" to "other_queue" queue.
$job2 = Job::create('other_queue', 'other_message_type', ['greet' => 'Hello world!!']);
$producer->enqueue($job2);
declare(strict_types=1);
use Antidot\Queue\JobPayload;
class SomeMessageTypeAction
{
public function __invoke(JobPayload $payload): void
{
// do some stuff with the job payload here.
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.