1. Go to this page and download the library: Download hao/mq 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/ */
hao / mq example snippets
$delay = new \mq\RabbitMQ();
$ttl = 1000 * 100;//订单100s后超时
$delayExName = 'delay-order-exchange';//超时exchange
$delayQueueName = 'delay-order-queue';//超时queue
$queueName = 'ttl-order-queue';//订单queue
$delay->createQueue($ttl, $delayExName, $delayQueueName, $queueName);
$data = [
'order_no' => time(),
'remark' => 'this is a order test'
];
$delay->sendMessage(json_encode($data), $queueName);