PHPackages                             metmit/alimns - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. metmit/alimns

ActiveLibrary[HTTP &amp; Networking](/categories/http)

metmit/alimns
=============

aliyun mns

167PHP

Since Mar 14Pushed 7y ago1 watchersCompare

[ Source](https://github.com/metmit/alimns)[ Packagist](https://packagist.org/packages/metmit/alimns)[ RSS](/packages/metmit-alimns/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (1)Used By (0)

Alimns
======

[](#alimns)

阿里云消息服务（MNS）的PHP客户端。

安装
--

[](#安装)

```
$ composer require metmit/alimns

```

使用
--

[](#使用)

阿里云MNS提供`队列`和`主题`两种方案，可按需选择。

```
$config = [
    'access_id'  => '123456',
    'access_key' => 'ABCDE',
    'end_point'  => '123.mns.cn-beijing.aliyuncs.com',
    'prefix'     => 'test-'
];
//获取实例
$instance = \Metmit\Alimns\Mns::getInstance($config);
$queue_name = 'ruesin-queue';
```

### 队列

[](#队列)

- 创建队列

```
$attributes = [
     'delay_seconds' => 0, //默认消息延时(秒)
     'max_message_size' => 65536, //消息最大长度(Byte)
     'alive_seconds' => 1296000, //消息存活时间(秒)
     'hide_seconds'  => 90, //取出消息隐藏时长(秒)
     'wait_seconds' => 10, //消息接收长轮询等待时间(秒)
     'enable_log' => false //开启logging
 ];
$result = $instance->createQueue($queue_name, $attributes);
```

- 发送消息

```
$messageBody = 'sin '. date('Y-m-d H:i:s');
$result = $instance->sendMessage($queue_name, $messageBody);
$result = $instance->sendMessage($queue_name, $messageBody, 500, 1);
```

- 消费消息 &amp; 删除消息

```
$message = $instance->receiveMessage($queue_name, 10);
if (!$message) return;
if ($message['state'] == 'ok') {
    print_r($message);
    echo base64_decode($message['msg']['MessageBody']);
    $instance->deleteMessage($queue_name, $message['msg']['ReceiptHandle']);
}
```

### 主题

[](#主题)

TODO

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

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.

### Community

Maintainers

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

---

Top Contributors

[![ruesin](https://avatars.githubusercontent.com/u/8240739?v=4)](https://github.com/ruesin "ruesin (6 commits)")

### Embed Badge

![Health badge](/badges/metmit-alimns/health.svg)

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

###  Alternatives

[friendsofsymfony/rest-bundle

This Bundle provides various tools to rapidly develop RESTful API's with Symfony

2.8k73.3M319](/packages/friendsofsymfony-rest-bundle)[php-http/discovery

Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations

1.3k309.5M1.2k](/packages/php-http-discovery)[nyholm/psr7

A fast PHP7 implementation of PSR-7

1.3k235.4M2.4k](/packages/nyholm-psr7)[pusher/pusher-php-server

Library for interacting with the Pusher REST API

1.5k94.8M293](/packages/pusher-pusher-php-server)[spatie/crawler

Crawl all internal links found on a website

2.8k16.3M52](/packages/spatie-crawler)[react/http

Event-driven, streaming HTTP client and server implementation for ReactPHP

78126.4M414](/packages/react-http)

PHPackages © 2026

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