afiqiqmal/huawei-push
Composer 安装命令:
composer require afiqiqmal/huawei-push
包简介
Simple Huawei Push in PHP
README 文档
README
Huawei Push PHP
Installation
composer require afiqiqmal/huawei-push
Usage
Get Access Token
References : Huawei OAuth
$access = HuaweiPushKit::make([ 'app_id' => 'YOUR APP ID', 'client_secret' => 'YOUR CLIENT SECRET' ]) ->getAccessToken(); //Laravel $access = HuaweiPushKit::make(config('huawei'))->getAccessToken(); $access = app(HuaweiPushKit::class)->getAccessToken();
Response
{
"access_token": "ACCESS TOKEN",
"expires_in": 3600, // seconds
"token_type": "Bearer"
}
Push Message
References : Huawei Push Kit
$response = HuaweiPushKit::make([]) ->withAccessToken('ACCESS TOKEN') ->push( NotificationPayload::make() ->setValidateOnly(false) ->setMessage( Message::make() ->setNotification( Notification::make() ->setTitle("Testing Title") ->setBody("Body") ->setImage("https://seeklogo.com/images/L/laravel-logo-41EC1D4C3F-seeklogo.com.png") ) ->setAndroid( Config::make() // AndroidConfig ->setUrgency(2) ->setCategory(1) ->setTimeToLive(3360) ->setTags('TrumpIsDown') ->isStaging(true) ->setNotification( AndroidNotification::make() // Notification ->setClickAction( ClickAction::make() ->setType(1) ->setIntent("pushscheme://com.huawei.hms.hmsdemo/deeplink?#Intent;i.isFeed=1;S.feedDocId=0LauP4X6;end") ->setUrl('https://www.google.com') ) ->setImage('https://seeklogo.com/images/L/laravel-logo-41EC1D4C3F-seeklogo.com.png') ->setIcon('/raw/ic_launcher2') ->setColor('#FFFFFF') ->setSound('/raw/shake') ->setDefaultSound(false) ->setPriority(3) ->setChannelId("HMSTestDemo") ->setAutoClear(100000) // ms ->setSummary("Summary") ->setStyle(0) ->setNotifyId(123456) ->setButtons([ Button::make()->setName("Home")->setActionType(0) ]) ) ) ->setTopic("Topic") ) );
Response
{
"code": "80000000",
"msg": "Success",
"requestId": "160502268063038626000406"
}
TODO
- WebPUSH
- APNS
License
Licensed under the MIT license
afiqiqmal/huawei-push 适用场景与选型建议
afiqiqmal/huawei-push 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 72.1k 次下载、GitHub Stars 达 9, 最近一次更新时间为 2020 年 11 月 10 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 afiqiqmal/huawei-push 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 afiqiqmal/huawei-push 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 72.1k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 9
- 点击次数: 15
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-11-10