PHP code example of terranc / laravel-mns

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

    

terranc / laravel-mns example snippets


'providers' => [
       // ...
   Milkmeowo\LaravelMns\LaravelMnsServiceProvider::class,
],

'connections' => [
    'redis' => [
        'driver'     => 'redis',
        'connection' => 'default',
        'queue'      => 'default',
        'expire'     => 60,
    ],
    // 新增阿里云 MNS。
    'mns'   => [
       'driver'       => 'mns',
       'key'          => env('QUEUE_MNS_ACCESS_KEY', ''),
       'secret'       => env('QUEUE_MNS_SECRET_KEY', ''),
       'endpoint'     => env('QUEUE_MNS_ENDPOINT', ''),
       'queue'        => env('QUEUE_NAME',''),
       'wait_seconds' => env('QUEUE_WAIT_SECONDS', 30),
   ],
],
bash
php artisan queue:mns:list 
// 例如
php artisan queue:mns:list
// 输入队列名以 prefix 开头的队列
php artisan queue:mns:list -p

# 请填写prefix:
# >

bash
php artisan queue:mns:create 队列名
// 例如
php artisan queue:mns:create wechat-notify
bash
php artisan queue:mns:delete 队列名
// 例如
php artisan queue:mns:delete wechat-notify
bash
php artisan queue:mns:flush 队列名
// 例如
php artisan queue:mns:flush wechat-notify