PHPackages                             dyjh/laravel-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. dyjh/laravel-mns

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

dyjh/laravel-mns
================

This package aggregate the message queue of laravel and aliyun IOT MNS.

0.1.0.x-dev(6y ago)410MITPHPPHP &gt;=7.2.0

Since Jan 17Pushed 6y ago1 watchersCompare

[ Source](https://github.com/dyjh/laravel-mns)[ Packagist](https://packagist.org/packages/dyjh/laravel-mns)[ RSS](/packages/dyjh-laravel-mns/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (2)Versions (2)Used By (0)

Aliyun MNS Queue Driver For Laravel 6.0
=======================================

[](#aliyun-mns-queue-driver-for-laravel-60)

[![Latest Version on Packagist](https://camo.githubusercontent.com/12f97c31a7496b5ef6fff69b25eb8e83dc1d52950805aa9305b90c6f8035717b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f64796a682f6c61726176656c2d6d6e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/dyjh/laravel-mns)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Total Downloads](https://camo.githubusercontent.com/2e2719b52d9225cf19b4e67c4278b038e94c550cd009bc649721e74ce74fc681/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f64796a682f6c61726176656c2d6d6e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/dyjh/laravel-mns)

The Laravel adaptation of aliyun messaging service (MNS) is essentially the addition of MNS drivers to Laravel's queues. Includes aliyun MNS SDK, which is necessary for Laravel to use MNS transparently.

> Changes from [lokielse/laravel-mns](https://github.com/lokielse/laravel-mns) to modify some of the content added manually call news release, added the laravel 6.0 support.

Install
-------

[](#install)

Via Composer

```
$ composer require dyjh/laravel-mns
```

Config
------

[](#config)

Add following service providers into your providers array in `config/app.php`

```
Dyjh\LaravelMNS\LaravelMNSServiceProvider::class
```

Edit your `config/queue.php`, add `mns` connection

```
'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' => 30,
    'receiveController' => ReceiveController::class,
]
```

About [wait\_seconds](https://help.aliyun.com/document_detail/35136.html)

Edit your `.env` file

```
QUEUE_DRIVER=mns
QUEUE_NAME=foobar-local
QUEUE_MNS_ACCESS_KEY=your_acccess_key
QUEUE_MNS_SECRET_KEY=your_secret_key
QUEUE_MNS_ENDPOINT=http://12345678910.mns.cn-hangzhou.aliyuncs.com/
```

You should update `QUEUE_MNS_ENDPOINT` to `internal endpoint` in production mode

MessageReceiver Example
-----------------------

[](#messagereceiver-example)

About \[ReceiveController\], please look at [Example](ReceiveExample.php)

Usage
-----

[](#usage)

First create a queue and get queue endpoint at [Aliyun MNS Console](https://mns.console.aliyun.com/)

Then update `MNS_ENDPOINT` in `.env`

Push a test message to queue

```
Queue::push(function($job){
	/**
	 * Your statments go here
	 */
	$job->delete();
});
```

Create queue listener, run command in terminal

```
$ php artisan queue:listen
```

or only create the receiver queue

```
$ php artisan queue:work mns
```

Commands
--------

[](#commands)

Flush MNS messages on Aliyun

```
$ php artisan queue:mns:flush
```

Manually publish message
------------------------

[](#manually-publish-message)

Send The Message to Aliyun MNS

```
$sender = new MNSSender("test");
$res = $sender->push("testMessage");
```

Security
--------

[](#security)

Create RAM access control at [Aliyun RAM Console](https://ram.console.aliyun.com)

1. Create a custom policy such as `AliyunMNSFullAccessFoobar`

    ```
    {
      "Version": "1",
      "Statement": [
    	{
    	  "Action": "mns:*",
    	  "Resource": [
    		"acs:mns:*:*:*/foobar-local",
    		"acs:mns:*:*:*/foobar-sandbox",
    		"acs:mns:*:*:*/foobar-production"
    	  ],
    	  "Effect": "Allow"
    	}
      ]
    }

    ```
2. Create a user for you app such as `foobar`
3. Assign the policy `AliyunMNSFullAccessFoobar` to the user `foobar`
4. Create and get the `AccessKeyId` and `AccessKeySecret` for user `foorbar`
5. update `QUEUE_MNS_ACCESS_KEY` and `QUEUE_MNS_ACCESS_SECRET` in `.env`

Testing
-------

[](#testing)

```
$ composer test
```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

20

—

LowBetter than 12% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 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

Unknown

Total

1

Last Release

2406d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/89c3b5706f58fef8a6c859ddea23c0c0cac5508bfe385d2b7c76b012f346956e?d=identicon)[dyjh](/maintainers/dyjh)

---

Top Contributors

[![dyjh](https://avatars.githubusercontent.com/u/24380570?v=4)](https://github.com/dyjh "dyjh (2 commits)")

---

Tags

phplaravelaliyunmnsaliyun-mns

### Embed Badge

![Health badge](/badges/dyjh-laravel-mns/health.svg)

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

###  Alternatives

[unopim/unopim

UnoPim Laravel PIM

10.8k2.5k](/packages/unopim-unopim)[api-platform/laravel

API Platform support for Laravel

58190.1k21](/packages/api-platform-laravel)[ecotone/laravel

Ecotone for Laravel — CQRS, Event Sourcing, Sagas, Durable Workflows, and Outbox on top of Laravel Queue, via PHP attributes.

21327.3k4](/packages/ecotone-laravel)[scriptdevelop/whatsapp-manager

Paquete para manejo de WhatsApp Business API en Laravel

793.9k](/packages/scriptdevelop-whatsapp-manager)

PHPackages © 2026

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