1. Go to this page and download the library: Download caylof/php-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/ */
caylof / php-queue example snippets
# consumers/TestPrint.php
namespace Caylof\Examples\Consumer;
use Caylof\Queue\ConsumerInterface;
class TestPrint implements ConsumerInterface
{
public function getQueue(): string
{
return 'test1';
}
public function handle(array $data): void
{
if (mt_rand(0, 10) > 5) {
throw new \Exception('test error');
}
var_dump($data);
}
}