PHPackages                             rookiejin/mipush - 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. rookiejin/mipush

ActiveLibrary

rookiejin/mipush
================

小米推送官方包,https://dev.mi.com/console/doc/detail?pId=230,PHP 2.2.20版 于2017.06.13更新

1.0(8y ago)225.1k↓100%MITPHP

Since Jan 22Pushed 8y agoCompare

[ Source](https://github.com/rookiejin/mipush)[ Packagist](https://packagist.org/packages/rookiejin/mipush)[ RSS](/packages/rookiejin-mipush/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

### 小米推送PHP包集成composer

[](#小米推送php包集成composer)

### 安装

[](#安装)

`composer require rookiejin/mipush`

### 使用

[](#使用)

```
use Rookiejin\Xmpush\Builder;
use Rookiejin\Xmpush\HttpBase;
use Rookiejin\Xmpush\Sender;
use Rookiejin\Xmpush\Constants;
use Rookiejin\Xmpush\Stats;
use Rookiejin\Xmpush\Tracer;
use Rookiejin\Xmpush\Feedback;
use Rookiejin\Xmpush\DevTools;
use Rookiejin\Xmpush\Subscription;
use Rookiejin\Xmpush\TargetedMessage;

$secret = '秘钥 ';
$package = '安卓包名';

// 常量设置必须在new Sender()方法之前调用
Constants::setPackage($package);
Constants::setSecret($secret);

//$aliasList = array('alias1', 'alias2');
$title = '你好';
$desc = '这是一条mipush推送消息';
$payload = '{"test":1,"ok":"It\'s a string"}';

$sender = new Sender();

// message1 演示自定义的点击行为
$message1 = new Builder();
$message1->title($title);  // 通知栏的title
$message1->description($desc); // 通知栏的descption
$message1->passThrough(0);  // 这是一条通知栏消息，如果需要透传，把这个参数设置成1,同时去掉title和descption两个参数
$message1->payload($payload); // 携带的数据，点击后将会通过客户端的receiver中的onReceiveMessage方法传入。
$message1->extra(Builder::notifyForeground, 1); // 应用在前台是否展示通知，如果不希望应用在前台时候弹出通知，则设置这个参数为0
$message1->notifyId(2); // 通知类型。最多支持0-4 5个取值范围，同样的类型的通知会互相覆盖，不同类型可以在通知栏并存
$message1->build();
$targetMessage = new TargetedMessage();
$targetMessage->setTarget('alias1', TargetedMessage::TARGET_TYPE_REGID); // 设置发送目标。可通过regID,alias和topic三种方式发送
$targetMessage->setMessage($message1);

echo "";
// 所有设备群发 具体可以到$sender类看注释，有单发和群发。方式都是传递Message
print_r($sender->broadcastAll($message1)->getRaw());

// message2 演示预定义点击行为中的点击直接打开app行为
//$message2 = new Builder();
//$message2->title($title);
//$message2->description($desc);
//$message2->passThrough(0);
//$message2->payload($payload); // 对于预定义点击行为，payload会通过点击进入的界面的intent中的extra字段获取，而不会调用到onReceiveMessage方法。
//$message2->extra(Builder::notifyEffect, 1); // 此处设置预定义点击行为，1为打开app
//$message2->extra(Builder::notifyForeground, 1);
//$message2->notifyId(0);
//$message2->build();
//$targetMessage2 = new TargetedMessage();
//$targetMessage2->setTarget('alias2', TargetedMessage::TARGET_TYPE_ALIAS);
//$targetMessage2->setMessage($message2);

//$targetMessageList = array($targetMessage);

//print_r($sender->broadcastAll($message1)->getRaw());

//print_r($sender->sendToAliases($message1, $aliasList)->getRaw());
//$stats = new Stats();
//$startDate = '20140301';
//$endDate = '20140312';
//print_r($stats->getStats($startDate,$endDate)->getData());
//$tracer = new Tracer();
//print_r($tracer->getMessageStatusById('t1000270409640393266xW')->getRaw());

```

### 具体可以查看官方文档

[](#具体可以查看官方文档)

- [官方下载页面](https://dev.mi.com/mipush/downpage/)
- [文档介绍页面](https://dev.mi.com/console/doc/detail?pId=230)

###  Health Score

33

—

LowBetter than 74% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity63

Established project with proven stability

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

3029d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7fa5a2a1b1fb3966a78ed0b4af3c3b7dc9ed27d9ee8fa380ba3aeb493c56c934?d=identicon)[rookiejin](/maintainers/rookiejin)

### Embed Badge

![Health badge](/badges/rookiejin-mipush/health.svg)

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

PHPackages © 2026

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