progpark / aliyun-mns-laravel by progpark

Laravel queue driver bases on Aliyun Message Service(MNS).
247
4
1
Package Data
Maintainer Username: progpark
Maintainer Contact: progpark@outlook.com (yedonghai)
Package Create Date: 2016-10-05
Package Last Update: 2016-11-09
Language: PHP
License: MIT
Last Refreshed: 2024-12-22 03:16:15
Package Statistics
Total Downloads: 247
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 4
Total Watchers: 1
Total Forks: 0
Total Open Issues: 0

aliyun-mns-laravel

该组件为 Laravel 5.3 的队列增加 MNS 驱动,引入了 Aliyun MNS SDK。

安装使用

首先,通过 Composer 安装扩展组件:

$ composer require progpark/aliyun-mns-laravel

其次,在 app\Http\Providers\AppServiceProvider.php 中,将驱动注册到常用 ServiceProvider 中:

\Queue::extend('alimns', function() {
    return new \MainPHP\Laravel\Aliyun\MnsConnector();
});

最后,在 config/queue.php 中增加队列驱动 alimns

'connections' => [
    'redis' => [
        'driver'     => 'redis',
        'connection' => 'default',
        'queue'      => 'default',
        'expire'     => 60,
    ],

    // Aliyun MNS Driver
    'alimns'   => [
        'driver'   => 'alimns',
        'queue'    => env('MNS_DEFAULT_QUEUE', ''),
        'key'      => env('MNS_ACCESS_KEY', ''),
        'secret'   => env('MNS_ACCESS_SECRET', ''),
        'endpoint' => env('MNS_ENDPOINT', ''), // 外网连接必须启用 https
    ],
],

正常使用 Laravel Queue 即可: https://laravel-china.org/docs/5.3/queues