PHPackages                             singiu/singpush - 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. [Mail &amp; Notifications](/categories/mail)
4. /
5. singiu/singpush

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

singiu/singpush
===============

整合了小米推送、华为推送、友盟推送、苹果推送服务的整合包。

1.0.3(7y ago)45691MITPHPPHP &gt;=5.4.0

Since Apr 10Pushed 7y ago1 watchersCompare

[ Source](https://github.com/Singiu/singpush)[ Packagist](https://packagist.org/packages/singiu/singpush)[ RSS](/packages/singiu-singpush/feed)WikiDiscussions master Synced 4d ago

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

整合了小米推送、华为推送、友盟推送、苹果推送服务的整合包
----------------------------

[](#整合了小米推送华为推送友盟推送苹果推送服务的整合包)

[![Latest Stable Version](https://camo.githubusercontent.com/2c29158f16197602fb336c94290b803d2f254cc1e08a73fa85403a9599060fcd/68747470733a2f2f706f7365722e707567782e6f72672f73696e6769752f73696e67707573682f762f737461626c65)](https://packagist.org/packages/singiu/singpush)[![Total Downloads](https://camo.githubusercontent.com/3b638ca7231f45e2899bcb6dca431deffd3303b23014ccbdebda9c9d12fa0160/68747470733a2f2f706f7365722e707567782e6f72672f73696e6769752f73696e67707573682f646f776e6c6f616473)](https://packagist.org/packages/singiu/singpush)[![Latest Unstable Version](https://camo.githubusercontent.com/950882c4f06e5647893cac60cb9e0c2aa2e9fd4306ecfa4b50b3c367f32a1114/68747470733a2f2f706f7365722e707567782e6f72672f73696e6769752f73696e67707573682f762f756e737461626c65)](https://packagist.org/packages/singiu/singpush)[![License](https://camo.githubusercontent.com/2175781c32ed8d08e2119327a330e27f996cf5a63e7187350849f42c6b8680a5/68747470733a2f2f706f7365722e707567782e6f72672f73696e6769752f73696e67707573682f6c6963656e7365)](https://packagist.org/packages/singiu/singpush)

这个是我自己项目中使用的包，因为在国内不能使用 Google 推送服务，Android 又来兼容各平台机型，所以需要在客户端植入各种推送 SDK。

后台服务也需要对应开发各类推送服务，我不想去接入各个平台提供的服务端 SDK，所以自己做了一个这样的整合包，目前功能只有发送简单的推送消息栏通知。

用户点击消息也是默认跳回到 app 而已。所以如果不能满足你的需求的，就不要使用了。

后续如果有时间，我会加入**自定义消息推送**和**消息透传**的功能，这样可能就会比较大众一些了。

### 安装

[](#安装)

可以使用 Composer 安装：

```
composer require singiu/singpush
```

### 使用方法

[](#使用方法)

#### 发关消息栏通知

[](#发关消息栏通知)

```
// 准备配置信息，不用全部都设定，用到哪个推送服务只设定对应的配置就可以了。
$config = array(
    // 苹果推送配置段。
    'apns' => [
        'certificate_path' => '证书地址，必需是绝对路径。如：/etc/nginx/cert/app_push_cert.pem',
        'certificate_passphrase' => '证书密码',
        'environment' => '如果是测试就填 sandbox，正式填production'
    ],
    // 小米推送配置段。
    'mi' => [
        'app_package_name' => '注意这里是填入 Android 应用的包名',
        'app_secret' => '填入对应资料'
    ],
    // 友盟推送配置段。
    'umeng' => [
        'app_key' => '填入对应资料',
        'app_master_secret' => '填入对应资料'
    ],
    // 华为推送配置段。
    'hms' => [
        'client_id' => '填入对应资料',
        'client_secret' => '填入对应资料'
    ]
);

// 然后可以这样使用。
$device_token = 'Your device token string'; // 从对应推送服务商那里获取的设备唯一标识符。
$title = '推送的消息标题';
$message = '需要推送的消息内容';
$push_service = 'apns'; // 需要使用的推送服务标志，对应配置信息中的 key 值，为 apns, mi, umeng, hms 中的一个。
Push::setConfig($config); // 设定配置。
Push::sendMessage($device_token, $title, $message, $push_service); // 推送消息。
```

如果你觉得配置过于麻烦，我推荐使用一个 php 下好用的配置包： [symfony/dotenv](https://github.com/symfony/dotenv)。

如果你会使用这个包，那就只需要将 vendor/singiu/singpush/src/.env.example 文件中对应的配置信息填好，然后拷贝到你的项目根目录下，并改名为 .env（如果你已经有这个文件，那就将 .env.example 中的内容复制并粘贴到你的 .env 文件的内容后面）。

一旦你这样做了，配合 symfony/dotenv 包，你就可以省去配置的环节，直接在你的项目的任何位置使用推送服务。如下：

```
$device_token = 'Your device token string';
$title = '推送的消息标题';
$message = '需要推送的消息内容';
$push_service = 'apns';
Push::sendMessage($device_token, $title, $message, $push_service);
```

### License

[](#license)

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

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community8

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

Total

4

Last Release

2585d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/68110d35506ef416f842839b6c94aae0259a6b81c676e27f903da9052d5a68d4?d=identicon)[Singiu](/maintainers/Singiu)

---

Top Contributors

[![Singiu](https://avatars.githubusercontent.com/u/3905448?v=4)](https://github.com/Singiu "Singiu (12 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/singiu-singpush/health.svg)

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

###  Alternatives

[tijsverkoyen/css-to-inline-styles

CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very useful when you're sending emails.

5.8k505.3M227](/packages/tijsverkoyen-css-to-inline-styles)[minishlink/web-push

Web Push library for PHP

1.9k12.0M53](/packages/minishlink-web-push)[laravel-notification-channels/twilio

Provides Twilio notification channel for Laravel

2587.7M12](/packages/laravel-notification-channels-twilio)[spatie/url-signer

Generate a url with an expiration date and signature to prevent unauthorized access

4422.3M16](/packages/spatie-url-signer)[mattketmo/email-checker

Throwaway email detection library

2742.0M5](/packages/mattketmo-email-checker)[laravel-notification-channels/discord

Laravel notification driver for Discord.

2371.3M11](/packages/laravel-notification-channels-discord)

PHPackages © 2026

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