genkgo/push
Composer 安装命令:
composer require genkgo/push
包简介
Send push messages to Android and Apple using one interface.
README 文档
README
Send push messages to Apple, Firebase and Web Push using one interface.
Installation
Requires a PHP version getting security updates. It is installable and autoloadable via Composer as genkgo/push.
Quality
To run the unit tests at the command line, issue phpunit -c tests/. PHPUnit is required.
This library attempts to comply with PSR-1, PSR-2, and PSR-4. If you notice compliance oversights, please send a patch via pull request.
Send Push Messages
<?php use Genkgo\Push\Body; use Genkgo\Push\Firebase\CloudMessaging; use Genkgo\Push\Firebase\OauthBearerTokenProvider; use Genkgo\Push\Gateway; use Genkgo\Push\Message; use Genkgo\Push\Sender\FirebaseSender; use Genkgo\Push\Sender\AppleApnSender; use Genkgo\Push\Sender\WebPushSender; use Genkgo\Push\Recipient\AndroidDeviceRecipient; use Genkgo\Push\Recipient\AppleDeviceRecipient; use Genkgo\Push\Recipient\FirebaseRecipient; use Genkgo\Push\Recipient\WebRecipient; use Genkgo\Push\WebPush\PayloadEncryption; // firebase oauth token $auth = new OauthBearerTokenProvider($guzzleClient, $guzzleHttpFactory, '/link/to/services-account.json'); // construct the gateway, using the different senders $gateway = new Gateway([ AppleApnSender::fromToken('/location/to/key.p8', 'keyId', 'teamId', 'bundleId'), new FirebaseSender(new CloudMessaging($guzzleClient, $guzzleHttpFactory, $auth), 'fcm-project-id'), new WebPushSender($guzzleClient, $guzzleHttpFactory, new PayloadEncryption(), '/link/to/private-key.pem', '/link/to/public-key.pem', 'mailto:address@domain.com'), ]); // below message will automatically go to their own specific sender $gateway->send(new Message(new Body('message content')), new AppleDeviceRecipient('token')); $gateway->send(new Message(new Body('message content')), new FirebaseRecipient('token')); $gateway->send(new Message(new Body('message content')), new WebRecipient('https://endpoint', 'keys.auth', 'keys.p256dh'));
Contributing
- Found a bug? Please try to solve it yourself first and issue a pull request. If you are not able to fix it, at least give a clear description what goes wrong. We will have a look when there is time.
- Want to see a feature added, issue a pull request and see what happens. You could also file a bug of the missing feature and we can discuss how to implement it.
genkgo/push 适用场景与选型建议
genkgo/push 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 33.61k 次下载、GitHub Stars 达 13, 最近一次更新时间为 2015 年 12 月 02 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 genkgo/push 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 genkgo/push 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 33.61k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 14
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2015-12-02