develandoo/yii2-push-notification
Composer 安装命令:
composer require develandoo/yii2-push-notification
包简介
Yii2 apns/gcm push notification
README 文档
README
INSTALLATION
Run
composer require develandoo/yii2-push-notification
or add
"develandoo/yii2-push-notification": "^1.0"
CONFIGURATION
in your main.php your configuration would look like this
'components' => [ 'push' => [ 'class' => 'develandoo\notification\Push', 'options' => [ 'returnInvalidTokens' => true //default false ], 'apnsConfig' => [ 'environment' => Push::APNS_ENVIRONMENT_PRODUCTION or Push::APNS_ENVIRONMENT_SANDBOX, 'pem' => 'PEM_FILE_ABS_URL', 'passphrase' => 'YOUR_PASS_PHRASE', //optional ], 'gcmConfig' => [ 'apiAccessKey' => 'YOUR_GCM_API_KEY' ] ] ]
EXAMPLE
$push = Yii::$app->push; // ios signle token example $push->ios()->send('token', [ 'custom-key' => 'custom-value', 'aps' => [ 'alert' => [ 'loc-key' => 'i18n_key', 'loc-args' => ['arg1'], ] ], 'badge' => 1, 'sound' => 'default' ]); // ios multiple tokens example $push->ios()->send(['token1,token2'], [ 'custom-key' => 'custom-value', 'aps' => [ 'alert' => 'STRING_MESSAGE' ], 'badge' => 1, 'sound' => 'default' ]); // android example $push->android()->send(['token1,token2'], [ 'key' => 'i18n_key', 'args' => ['arg1'], 'custom-key'=>'custom-value' ]); // mixed tokens example $push->send([ 'ios-tokens1', 'android-token1', 'android-token2', 'ios-token2' ], $payload); // firebase (both ios and android are supported) multiple tokens example $push->firebase()->send(['token1','token2'], [ // Background (closed) application data. 'notification' => [ 'body' => 'Background application message', 'title' => 'AppName', 'sound' => 'default', ], // Foreground (running) application data. 'data' => [ 'custom-key' => 'Any custom data could be delivered into foreground application. ' . 'In order to simulate push notification, this data should be used inside "local notification" by client application.', ], ]);
EXCEPTION CASES
Apns environment is invalid.Apns pem is invalid.Gcm api access key is invalid.Gcm in not enabled.Apns in not enabled.
© DEVELANDOO 2017
develandoo/yii2-push-notification 适用场景与选型建议
develandoo/yii2-push-notification 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 30.79k 次下载、GitHub Stars 达 36, 最近一次更新时间为 2017 年 01 月 17 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「notification」 「push」 「yii2」 「develandoo」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 develandoo/yii2-push-notification 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 develandoo/yii2-push-notification 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 develandoo/yii2-push-notification 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
This package makes it easy to send notifications via AfricasTalking with Laravel
A custom URL rule class for Yii 2 which allows to create translated URL rules
Apple Push Notification & Feedback Provider
Throttle notifications on a per-channel basis
Laravel package to send push notifications to mobile devices (apns, gcm)
Extensible library for building notifications and sending them via different delivery channels.
统计信息
- 总下载量: 30.79k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 37
- 点击次数: 21
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2017-01-17