irfanmumtaz/firebase-cloud-message
Composer 安装命令:
composer create-project irfanmumtaz/firebase-cloud-message
包简介
Laravel-FCM is an easy to use package working with both Laravel for sending push notification with Firebase Cloud Messaging (FCM)
README 文档
README
LARAVEL FCM
Laravel-FCM is an easy to use package working with both Laravel for sending push notification with Firebase Cloud Messaging (FCM)
Installation
Use composer to install laravel fcm.
composer require irfanmumtaz/firebase-cloud-message
Or you can add it directly in your composer.json file:
{
"require": {
"irfanmumtaz/firebase-cloud-message": "^0.1.1"
}
}
Laravel
Register the provider directly in your app configuration file config/app.php config/app.php:
'providers' => [ // ... Irfanmumtaz\FirebaseCloudMessage\FCMServiceProvider::class, ]
Publish the package config file using the following command:
$ php artisan vendor:publish --provider="Irfanmumtaz\FirebaseCloudMessage\FCMServiceProvider"
Usage
use Irfanmumtaz\FirebaseCloudMessage\FirebaseCM; use Irfanmumtaz\FirebaseCloudMessage\NotificationBuilder; //create notification builder $notification = new NotificationBuilder("Test notification"); $notification->setBody("test") ->tag('larvael'); /** * you can set other notification params * documentation here https://firebase.google.com/docs/cloud-messaging/http-server-ref * setBody(), setSound(), setBadge(), setClickAction(), setSubTitle(), setBodyLocKey(), * setBodyLocArgs(), setTitleLocKey(), setTitleLocArgs(), setAndroidChannelId(), setIcon(), setTag(), * setColor() */ //you can set option parameters $notification->options->setCollapseKey("example")->setPriority("high"); /** * you can set other option params * documentation here https://firebase.google.com/docs/cloud-messaging/http-server-ref * setCollapseKey(), setPriority(), setContentAvailable(), setMutableContent(), * setTimeToLive(), setRestrictedPackageName(), setDryRun() * */ //custom data can be added in this way $notification->custom->addData("key1", "value1")->addData("key2", "value2"); /** * Other usable functions in custom data * addData("key", "value") you can add custom data as many you want * removeData() remove all keys from custom data * unsetData("key1") remove a single key from custom data * getData() get complete custom data as array */ //create an object for FCM and pass notification while creating object $fcm = new FirebaseCM($notification); $fcm->setTo('firebase key')->send(); /** * Other FCM functions * setTo("key") uses for sending notification to a single user, pass token as string * setRegistrations(["key1", "key2"]) uses for sending notification to multiple users pass array of string * send() uses to send notificaiton */
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
License
irfanmumtaz/firebase-cloud-message 适用场景与选型建议
irfanmumtaz/firebase-cloud-message 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.64k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 12 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 irfanmumtaz/firebase-cloud-message 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 irfanmumtaz/firebase-cloud-message 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 3.64k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 7
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-12-21