erickskrauch/fcm
Composer 安装命令:
composer require erickskrauch/fcm
包简介
PHP application server for google firebase cloud messaging (FCM)
README 文档
README
Just another client to send push notifications via Firebase Cloud Messaging (FCM). The implementation is inspired by Paragraph1/php-fcm and its fork guigpm/php-fcm, but heavily reworked in favor of simpler code and better implementation.
Installation
This library relies on PSR-18 which defines how HTTP message should be sent and received. You can use any library to send HTTP messages that implements psr/http-client-implementation. Read more about PSR-18 in this blog.
To install this library with Guzzle you may run the following command:
composer require erickskrauch/fcm guzzlehttp/guzzle
Or using the curl client (you'll need to provide a PSR7 implementation such as nyholm/psr7 if not using Guzzle):
composer require erickskrauch/fcm php-http/curl-client nyholm/psr7
Usage
The component's constructor allows you to explicitly pass all dependencies. But you can also pass only the mandatory API token, and all other dependencies will be found automatically. The example below relies on auto discovery.
use ErickSkrauch\Fcm\Client; use ErickSkrauch\Fcm\Message\Message; use ErickSkrauch\Fcm\Message\Notification; use ErickSkrauch\Fcm\Recipient\Device; $client = new Client('SERVICE ACCOUNT OAUTH TOKEN', 'project-x146w'); $notification = new Notification(, 'testing body'); $notification->setTitle('Wow, something happened...'); $notification->setBody('It just works!'); $message = new Message(); $message->setNotification($notification); $message->setCollapseKey('collapse.key'); $recipient = new Device('your-device-token'); // or new ErickSkrauch\Fcm\Recipient\Topic('topic'); $result = $client->send($message, $recipient);
Contribute
This library in an Open Source under the MIT license. It is, thus, maintained by collaborators and contributors.
Feel free to contribute in any way. As an example you may:
- Trying out the
mastercode. - Create issues if you find problems.
- Reply to other people's issues.
- Review PRs.
Ensuring code quality
The project has several tools for quality control. All checks are performed in CI, but if you want to perform checks locally, here are the necessary commands:
vendor/bin/php-cs-fixer fix -v
vendor/bin/phpstan analyse
vendor/bin/phpunit
vendor/bin/infection # Try "env XDEBUG_MODE=coverage vendor/bin/infection" in case of errors
erickskrauch/fcm 适用场景与选型建议
erickskrauch/fcm 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 35.66k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 12 月 08 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「notifications」 「google」 「android」 「gcm」 「ios」 「firebase」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 erickskrauch/fcm 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 erickskrauch/fcm 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 erickskrauch/fcm 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Laravel Nova package that adds a notification feed in your Nova app.
Firebase cloud messaging http v1 php
Standalone PHP library for easy devices notifications push.
Scrapes app data from Google Play store.
Magento 2 Social Login extension is designed for quick login to your Magento 2 store without procesing complex register steps
A Mobile Push Notification Library
统计信息
- 总下载量: 35.66k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 23
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-12-08