PHPackages                             qwe840207103/jpush - 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. qwe840207103/jpush

ActiveLibrary

qwe840207103/jpush
==================

JPush API PHP Client

v3.6.6(6y ago)018MITPHPPHP &gt;=5.3.3

Since Jun 28Pushed 6y agoCompare

[ Source](https://github.com/qwe840207103/jpush-api-php-client)[ Packagist](https://packagist.org/packages/qwe840207103/jpush)[ Docs](https://github.com/jpush/jpush-api-php-client)[ RSS](/packages/qwe840207103-jpush/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (1)Versions (74)Used By (0)

JPush API PHP Client
====================

[](#jpush-api-php-client)

这是 JPush REST API 的 PHP 版本封装开发包，是由极光推送官方提供的，一般支持最新的 API 功能。

对应的 REST API 文档: [https://docs.jiguang.cn/jpush/server/push/server\_overview/](https://docs.jiguang.cn/jpush/server/push/server_overview/)

> 支持的 PHP 版本: 5.3.3 ～ 5.6.x, 7.x

> 若需要兼容 PHP 5.3.3 以下版本，可以使用 [v3 分支的代码](https://github.com/jpush/jpush-api-php-client/tree/v3)。 因为运行 Composer 需要 PHP 5.3.2+ 以上版本，所以其不提供 Composer 支持， 也可以[点击链接](https://github.com/jpush/jpush-api-php-client/releases)下载 v3.4.x 版本源码。

Installation
------------

[](#installation)

#### 使用 Composer 安装

[](#使用-composer-安装)

- 在项目中的 `composer.json` 文件中添加 jpush 依赖：

```
"require": {
    "jpush/jpush": "*"
}
```

- 执行 `$ php composer.phar install` 或 `$ composer install` 进行安装。

#### 直接下载源码安装

[](#直接下载源码安装)

> 直接下载源代码也是一种安装 SDK 的方法，不过因为有版本更新的维护问题，所以这种安装方式**十分不推荐**，但由于种种原因导致无法使用 Composer，所以我们也提供了这种情况下的备选方案。

- 下载源代码包，解压到项目中
- 在项目中引入 autoload：

```
require 'path_to_sdk/autoload.php';
```

Usage
-----

[](#usage)

- [Init API](https://github.com/jpush/jpush-api-php-client/blob/master/doc/api.md#init-api)
- [Push API](https://github.com/jpush/jpush-api-php-client/blob/master/doc/api.md#push-api)
- [Report API](https://github.com/jpush/jpush-api-php-client/blob/master/doc/api.md#report-api)
- [Device API](https://github.com/jpush/jpush-api-php-client/blob/master/doc/api.md#device-api)
- [Schedule API](https://github.com/jpush/jpush-api-php-client/blob/master/doc/api.md#schedule-api)
- [Exception Handle](https://github.com/jpush/jpush-api-php-client/blob/master/doc/api.md#schedule-api)
- [HTTP/2 Support](https://github.com/jpush/jpush-api-php-client/blob/master/doc/http2.md)
- [Group Push](https://github.com/jpush/jpush-api-php-client/blob/master/doc/grouppush.md)

#### 初始化

[](#初始化)

```
use JPush\Client as JPush;
...
...

    $client = new JPush($app_key, $master_secret);

...
```

OR

```
$client = new \JPush\Client($app_key, $master_secret);
```

#### 简单推送

[](#简单推送)

```
$client->push()
    ->setPlatform('all')
    ->addAllAudience()
    ->setNotificationAlert('Hello, JPush')
    ->send();
```

#### 异常处理

[](#异常处理)

```
$pusher = $client->push();
$pusher->setPlatform('all');
$pusher->addAllAudience();
$pusher->setNotificationAlert('Hello, JPush');
try {
    $pusher->send();
} catch (\JPush\Exceptions\JPushException $e) {
    // try something else here
    print $e;
}
```

Examples
--------

[](#examples)

**注意: 这只是使用样例, 不应该直接用于实际环境中!!**

在下载的中的 [examples](https://github.com/jpush/jpush-api-php-client/tree/master/examples) 文件夹有简单示例代码, 开发者可以参考其中的样例快速了解该库的使用方法。

> \*\*注：所下载的样例代码不可马上使用，需要在 `examples/config.php` 文件中填入相关的必要参数，或者设置相关环境变量，不进行这个操作则示例运行会失败。\*\*另外为保护开发者隐私 examples/config.php 文件不在版本控制中，需要使用如下命令手动复制：

```
$ cp examples/config.php.example examples/config.php
```

**简单使用方法**

若要运行 push\_example.php 中的示例代码：

```
# 假定当前目录为 JPush 源码所在的根目录
$ php examples/push_example.php
```

> 同时也可编辑相关的示例文件，更改参数查看执行效果

Testing
-------

[](#testing)

```
# 编辑 tests/bootstrap.php 文件，填入必须的变量值
# OR 设置相应的环境变量

# 运行全部测试用例
$ composer tests

# 运行某一具体测试用例
$ composer tests/JPush/xxTest.php
```

Contributing
------------

[](#contributing)

Bug reports and pull requests are welcome on GitHub at .

License
-------

[](#license)

The library is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 82.2% 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 ~28 days

Recently: every ~106 days

Total

70

Last Release

2356d ago

PHP version history (2 changes)v3.3.9PHP &gt;=5.1

v3.5.0PHP &gt;=5.3.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/13118623?v=4)[qwe840207103](/maintainers/qwe840207103)[@qwe840207103](https://github.com/qwe840207103)

---

Top Contributors

[![xiezefan](https://avatars.githubusercontent.com/u/4147649?v=4)](https://github.com/xiezefan "xiezefan (212 commits)")[![zincal8](https://avatars.githubusercontent.com/u/5654577?v=4)](https://github.com/zincal8 "zincal8 (28 commits)")[![javenfang](https://avatars.githubusercontent.com/u/287721?v=4)](https://github.com/javenfang "javenfang (5 commits)")[![qwe840207103](https://avatars.githubusercontent.com/u/13118623?v=4)](https://github.com/qwe840207103 "qwe840207103 (3 commits)")[![tanggaolin](https://avatars.githubusercontent.com/u/10041852?v=4)](https://github.com/tanggaolin "tanggaolin (2 commits)")[![wyzhcn](https://avatars.githubusercontent.com/u/1079779?v=4)](https://github.com/wyzhcn "wyzhcn (2 commits)")[![dhlwing](https://avatars.githubusercontent.com/u/735770?v=4)](https://github.com/dhlwing "dhlwing (1 commits)")[![dying318](https://avatars.githubusercontent.com/u/4433795?v=4)](https://github.com/dying318 "dying318 (1 commits)")[![xiamengyu](https://avatars.githubusercontent.com/u/7949004?v=4)](https://github.com/xiamengyu "xiamengyu (1 commits)")[![jg-daixuan](https://avatars.githubusercontent.com/u/48434147?v=4)](https://github.com/jg-daixuan "jg-daixuan (1 commits)")[![zheng93775](https://avatars.githubusercontent.com/u/51202509?v=4)](https://github.com/zheng93775 "zheng93775 (1 commits)")[![leo108](https://avatars.githubusercontent.com/u/1551716?v=4)](https://github.com/leo108 "leo108 (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/qwe840207103-jpush/health.svg)

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

PHPackages © 2026

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