PHP code example of uniondrug / mq

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

    

uniondrug / mq example snippets


class ExampleController ... 
{
    public function indexAction()
    {
        $order = OrderStruct::init(...);
        $mq = new Mq();
        $mq->order->afterAudit($order);
    }
}

class ExampleController ... 
{
    public function testAction()
    {
        // 提取数据, 以下二种来源
        // 1. 来自MQ
        // 2. API请求
        $payload = $this->getPayloadBody();
        
        // 打印结果如下:
        // {
        //     "key" => "value"
        // }
        print_r (json_encode($payload, true));
    }
}