PHPackages                             zdz/alimns-helper-php - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. zdz/alimns-helper-php

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

zdz/alimns-helper-php
=====================

aliyun,mns,mq

1.1.1(6y ago)05.5kMITPHP

Since May 27Pushed 6y agoCompare

[ Source](https://github.com/zdz1715/alimns-helper-php)[ Packagist](https://packagist.org/packages/zdz/alimns-helper-php)[ RSS](/packages/zdz-alimns-helper-php/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (3)Dependencies (1)Versions (4)Used By (0)

阿里云mns消息服务
==========

[](#阿里云mns消息服务)

使用composer安装
------------

[](#使用composer安装)

`composer require zdz/alimns-helper-php`

用法
--

[](#用法)

### 初始化客户端

[](#初始化客户端)

```
    use use AliMNS\MnsHandle;

    $endPoint = ''; // your endPoint
    $accessId = ''; // your accessId
    $accessKey = ''; // your accessKey

    $client = MnsHandle::client($endPoint, $accessId, $accessKey);

```

### 创建队列

[](#创建队列)

```
    try {
        $client->createQueue($queueName, $attributes);
    } catch(\Exception $e) {
        echo 'falid'. $e->getMessage();
    }

```

- queueName: 队列名称
- attributes: \\AliyunMNS\\Model\\QueueAttributes对象

### 发送消息

[](#发送消息)

```
    try {
        $client->sendMessage($queueName, $messageBody, $delaySeconds, $priority, $base64);
    } catch(\Exception $e) {
        echo 'falid'. $e->getMessage();
    }

```

- queueName: 队列名称
- messageBody: 消息内容
- delaySeconds: 指定的秒数延后可被消费，单位为秒
- priority: 指定消息的优先级权值，优先级越高的消息，越容易更早被消费, 取值范围1~16（其中1为最高优先级），默认优先级为8
- base64：base64加密，默认true

### 消费消息

[](#消费消息)

```
    try {
        $messageResult = $client->receiveMessage($queueName, $autoDelete, $waitSeconds);
    } catch(\Exception $e) {
        echo 'falid'. $e->getMessage();
    }

```

- queueName: 队列名称
- autoDelete: 是否自动删除，默认false
- waitSeconds: 本次 ReceiveMessage 请求最长的Polling等待时间，单位为秒。默认30，30是最大值

### 删除消息

[](#删除消息)

```
    $receiptHandle = $messageResult->getReceiptHandle();
    try {
        $client->deleteMessage($queueName, $receiptHandle);
    } catch(\Exception $e) {
        echo 'falid'. $e->getMessage();
    }

```

- queueName: 队列名称
- receiptHandle: 通过消费消息的返回值获取的临时句柄,

### 删除队列

[](#删除队列)

```
    try {
        $client->deleteQueue($queueName);
    } catch(\Exception $e) {
        echo 'falid'. $e->getMessage();
    }

```

- queueName: 队列名称

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity61

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 ~43 days

Total

3

Last Release

2453d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/bd31bfe8db255090519cb3caff69f44367d2693c6082308e7b411ff6e1e3e288?d=identicon)[z171535](/maintainers/z171535)

---

Top Contributors

[![zdz1715](https://avatars.githubusercontent.com/u/24859074?v=4)](https://github.com/zdz1715 "zdz1715 (3 commits)")

### Embed Badge

![Health badge](/badges/zdz-alimns-helper-php/health.svg)

```
[![Health](https://phpackages.com/badges/zdz-alimns-helper-php/health.svg)](https://phpackages.com/packages/zdz-alimns-helper-php)
```

###  Alternatives

[norkunas/youtube-dl-php

youtube-dl / yt-dlp wrapper for php

512323.2k15](/packages/norkunas-youtube-dl-php)[browner12/helpers

generic helpers

289676.6k7](/packages/browner12-helpers)[kop/yii2-scroll-pager

Infinite AJAX scrolling for Yii2 ListView widget

180706.5k10](/packages/kop-yii2-scroll-pager)[tonysm/importmap-laravel

Use ESM with importmap to manage modern JavaScript in Laravel without transpiling or bundling.

148399.8k1](/packages/tonysm-importmap-laravel)[duncan3dc/fork-helper

Simple class to fork processes in PHP and allow multi-threading

73548.0k4](/packages/duncan3dc-fork-helper)[timothyasp/nova-badge-field

A Laravel Nova field.

58548.0k](/packages/timothyasp-nova-badge-field)

PHPackages © 2026

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