yii-jpush - 适配于 Yii 的极光推送扩展包 [ 2.0 版本 ]
yii-jpush - 适配于 Yii 的极光推送扩展包

环境要求
- yii >= 2
 
安装
$ composer require guanguans/yii-jpush -v
配置
Yii2 配置文件 config/main.php 的 components 中添加:
'components' => [
	// ...
	'jpush' => [
        'class' => 'Guanguans\YiiJpush\Jpush',
        'appKey' => 'xxxxxxxxxxx',
        'masterSecret' => 'xxxxxxxxxxx',
        'logFile' => './jpush.log', // 可选
        'retryTimes' => 3, // 可选
        'zone' => 'default', // 可选 [default, bj]
    ],
	// ...
]
使用,更多详细文档请参考 jpush/jpush-api-php-client
获取 JPush\Client 实例
<php
Yii::$app->jpush->client
简单使用
<?php
Yii::$app->jpush->client->push()
    ->setPlatform('all')
    ->addAllAudience()
    ->setNotificationAlert('Hello, JPush')
    ->send();
异常处理
<?php
$pusher = Yii::$app->jpush->client->push();
$pusher->setPlatform('all');
$pusher->addAllAudience();
$pusher->setNotificationAlert('Hello, JPush');
try {
    $pusher->send();
} catch (\Exception $e) {
    // try something else here
    echo $e;
}
guanguans
            注册时间:2017-12-11
最后登录:2024-11-13
在线时长:9小时2分
    最后登录:2024-11-13
在线时长:9小时2分
- 粉丝4
 - 金钱75
 - 威望60
 - 积分765
 
热门源码
- 整合完 yii2-rbac+yii2-admin+adminlte 等库的基础开发后台源码
 - 基于 Yii 2 + Bootstrap 3 搭建一套后台管理系统 CMF
 - 适合初学者学习的一款通用的管理后台
 - yii-goaop - 将 goaop 集成到 Yii,在 Yii 中优雅的面向切面编程
 - yii-log-target - 监控系统异常且多渠道发送异常信息通知
 - 店滴云1.3.0
 - 面向对象的一小步:添加 ActiveRecord 的 Scope 功能
 - Yii2 开源商城 FecShop
 - 基于 Yii2 开发的多店铺商城系统,免费开源 + 适合二开
 - leadshop - 基于 Yii2 开发的一款免费开源且支持商业使用的商城管理系统
 
共 0 条评论