PHPackages                             calchen/laravel-queue-aliyun-mns - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Queues &amp; Workers](/categories/queues)
4. /
5. calchen/laravel-queue-aliyun-mns

ActiveLibrary[Queues &amp; Workers](/categories/queues)

calchen/laravel-queue-aliyun-mns
================================

阿里云消息服务 Laravel/Lumen 扩展包（Aliyun MNS for Laravel/Lumen）

2.2.0(5y ago)10291MITPHPPHP ^7.0

Since Sep 1Pushed 5y ago1 watchersCompare

[ Source](https://github.com/calchen/laravel-queue-aliyun-mns)[ Packagist](https://packagist.org/packages/calchen/laravel-queue-aliyun-mns)[ RSS](/packages/calchen-laravel-queue-aliyun-mns/feed)WikiDiscussions master Synced yesterday

READMEChangelog (5)Dependencies (4)Versions (12)Used By (0)

 laravel-queue-aliyun-mns
==========================

[](#-laravel-queue-aliyun-mns-)

 阿里云消息服务（MNS） Laravel/Lumen 扩展包

 [ ![Style CI](https://camo.githubusercontent.com/9e4be702a355e94fd24f7064c4886879383f2551d1b289821f916ae694336c1b/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3230353537333339342f736869656c643f7374796c653d666c6174) ](https://github.styleci.io/repos/205573394) [ ![Travis CI](https://camo.githubusercontent.com/77bf6c48edeb1ac594c44fcfbee20030d3c3531dcb76eb32ffaab46ac8d4e679/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f636f6d2f63616c6368656e2f6c61726176656c2d71756575652d616c6979756e2d6d6e732e737667) ](https://travis-ci.com/calchen/laravel-queue-aliyun-mns) [ ![Coverage Status](https://camo.githubusercontent.com/9fd92f9193fb9f065d8e6b9ed7255ccade170555513aa65c00f6db923ad410ee/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f63616c6368656e2f6c61726176656c2d71756575652d616c6979756e2d6d6e732f62616467652e7376673f6272616e63683d6d6173746572) ](https://coveralls.io/github/calchen/laravel-queue-aliyun-mns?branch=master) [ ![Latest Stable Version](https://camo.githubusercontent.com/8132b493ad8dee2e968c153c4d4d529e16d8a26a8bd96aa360a0d345d7adba7a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f63616c6368656e2f6c61726176656c2d71756575652d616c6979756e2d6d6e732e737667) ](https://packagist.org/packages/calchen/laravel-queue-aliyun-mns) [ ![Total Downloads](https://camo.githubusercontent.com/cc316246626bf857d54376e9aba89b7f77704423f77db2b3c1f3606448ae798a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f63616c6368656e2f6c61726176656c2d71756575652d616c6979756e2d6d6e732e737667) ](https://packagist.org/packages/calchen/laravel-queue-aliyun-mns) [ ![License](https://camo.githubusercontent.com/e6c8d7401bd873d49352b70183121a601b180ada440006f2e1dfed7798d418dc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f63616c6368656e2f6c61726176656c2d71756575652d616c6979756e2d6d6e732e737667) ](https://github.com/calchen/laravel-queue-aliyun-mns/blob/master/LICENSE)

> [English](https://github.com/calchen/laravel-queue-aliyun-mns/blob/master/README_en.md)

这是一个基于[阿里云 MNS SDK](https://github.com/aliyun/aliyun-mns-php-sdk)的 Laravel/Lumen 队列驱动扩展包

安装
--

[](#安装)

推荐使用 composer 进行安装：

```
$ composer require calchen/laravel-queue-aliyun-mns:^2.0
```

### Laravel

[](#laravel)

Laravel 5.5+ 已经实现了扩展包发现机制，您不需要进行额外的加载操作

### Lumen

[](#lumen)

Lumen 并未移植扩展包自动发现机制，所以需要手动加载扩展包并复制配置文件。

打开配置文件 `bootstrap/app.php` 并在大约 81 行左右添加如下内容：

```
$app->register(Calchen\LaravelQueueAliyunMns\AliyunMnsServiceProvider::class);
```

将文件系统配置文件从 `vendor/laravel/lumen-framework/queue.php` 复制到 `config/queue.php`

配置
--

[](#配置)

打开配置文件 `config/queue.php` 并在 `connections` 中添加如下内容：

```
'mns' => [
    'driver' => 'mns',
    'access_key_id' => env('ALIYUN_ACCESS_KEY_ID'),
    'access_key_secret' => env('ALIYUN_ACCESS_KEY_SECRET'),
    'endpoint' => env('ALIYUN_MNS_ENDPOINT'),
    'queue' => env('ALIYUN_MNS_QUEUE'),
],
```

如果您想将阿里云 MNS 作为默认的队列，那么可以在 `.env` 文件中设置配置项 `QUEUE_CONNECTION=mns`

### 配置说明

[](#配置说明)

配置项必须说明备注driver是驱动名称默认值：mns，不可修改access\_id是用于身份验证的 AccessKey ID见下文“安全提醒”access\_key\_secret是用于身份验证的 AccessKey Key Secret见下文“安全提醒”endpoint是地域节点见下文“地域节点”queue是队列名称-wait\_seconds否即长轮询时长[消费消息](https://help.aliyun.com/document_detail/35136.html?spm=a2c4g.11186623.6.675.37e35c40Hzv2FW#h2-request)#### 地域节点（endpoint）

[](#地域节点endpoint)

在[阿里云 MNS 控制台](https://mns.console.aliyun.com)选择正确的区域后，点击“获取 Endpoint”按钮查看对应的地域节点。

需要注意的是您看到的地域节点可能是这样的 `http(s)://1687399289328741.mns.cn-hangzhou.aliyuncs.com/`，但实际上只能使用 `https://1687399289328741.mns.cn-hangzhou.aliyuncs.com/` 或 `http://1687399289328741.mns.cn-hangzhou.aliyuncs.com/`

#### 安全提醒

[](#安全提醒)

为了安全，请使用子账户的 AccessKey ID 和 AccessKey Key Secret，请务必不要使用主账户的 AccessKey ID 和 AccessKey Key Secret

### RAM 访问控制权限策略参考

[](#ram-访问控制权限策略参考)

本项目使用了阿里云 MNS 的这些方法：GetQueueAttributes、SendMessage、ReceiveMessage、DeleteMessage、ChangeMessageVisibility。

根据[阿里云 MNS 文档](https://help.aliyun.com/document_detail/27448.html?spm=a2c4g.11186623.6.597.27f31b2dQ1x64i)并践行最佳安全实践，为 RAM 用户授予最小权限。这里以杭州区（cn-hangzhou）名称为 laravel-queue-aliyun-mns 的队列为例：

```
{
    "Version": "1",
    "Statement": [
        {
            "Action": "mns:GetQueueAttributes",
            "Resource": [
                "acs:mns:cn-hangzhou:*:/queues/laravel-queue-aliyun-mns"
            ],
            "Effect": "Allow"
        },
        {
            "Action": [
                "mns:SendMessage",
                "mns:ReceiveMessage",
                "mns:DeleteMessage",
                "mns:ChangeMessageVisibility"
            ],
            "Resource": [
                "acs:mns:cn-hangzhou:*:/queues/laravel-queue-aliyun-mns/messages"
            ],
            "Effect": "Allow"
        }
    ]
}
```

开源协议
----

[](#开源协议)

[MIT](http://opensource.org/licenses/MIT)

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~41 days

Recently: every ~56 days

Total

11

Last Release

2030d ago

Major Versions

1.0.1 → 2.0.02019-09-22

1.1.0 → 2.0.12019-09-22

1.0.x-dev → 2.1.02020-03-08

PHP version history (3 changes)1.0.0PHP ^7.1.3

2.0.0PHP &gt;=7.0

1.1.0PHP ^7.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/817a37d0a77c2cd34160f84728e75171c7d8a4c6ac9621eaeaa611ca4d720ea9?d=identicon)[calchen](/maintainers/calchen)

---

Top Contributors

[![calchen](https://avatars.githubusercontent.com/u/3085383?v=4)](https://github.com/calchen "calchen (72 commits)")

---

Tags

laravellumenqueuealiyunmnsmessage notification service

### Embed Badge

![Health badge](/badges/calchen-laravel-queue-aliyun-mns/health.svg)

```
[![Health](https://phpackages.com/badges/calchen-laravel-queue-aliyun-mns/health.svg)](https://phpackages.com/packages/calchen-laravel-queue-aliyun-mns)
```

###  Alternatives

[shiftonelabs/laravel-sqs-fifo-queue

Adds a Laravel queue driver for Amazon SQS FIFO queues.

1556.0M3](/packages/shiftonelabs-laravel-sqs-fifo-queue)[joblocal/laravel-sqs-sns-subscription-queue

A simple Laravel service provider which adds a new queue connector to handle SNS subscription queues.

48416.3k](/packages/joblocal-laravel-sqs-sns-subscription-queue)[mingalevme/illuminate-uqueue

Laravel/Lumen uniqueable queues (Database, Redis)

2148.0k1](/packages/mingalevme-illuminate-uqueue)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
