定制 daldan26/fcmv1 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

daldan26/fcmv1

最新稳定版本:v1.0.5

Composer 安装命令:

composer require daldan26/fcmv1

包简介

FCM HTTP V1 packages

README 文档

README

A Laravel package that lets you use the new FCM Http V1 API and send push notifications with ease.

Firebase

  1. Go to the Firebase console.

Laravel

FCM_API_KEY="<firebase apiKey>"
FCM_AUTH_DOMAIN="<firebase authDomain>"
FCM_PROJECT_ID="<firebase projectId>"
FCM_STORAGE_BUCKET="<firebase storageBucket>"
FCM_MESSAGIN_SENDER_ID="<firebase messagingSenderId>"
FCM_APP_ID="<firebase appId>"
FCM_JSON="<name of the json file downloaded at firebase step 7 install>"
FCM_API_SERVER_KEY=<api server key step 8-9 of firebase install>
  1. Package installation
composer require daldan26/fcmv1
  1. Register the provider in config/app.php
Daldan26\Fcmv1\FcmProvider::class,
  1. Publish config file
php artisan vendor:publish --tag=fcmv1 --ansi --force

Usage

Topics

Topics are used to make groups of device tokens. They will allow you to send notification directly to the topic where users are registered in.

Subscribe

To subscribe tokens to a topic :

use Daldan26\Fcmv1\FcmTopicHelper;

$tokens = ["first token", ... , "last token"];
FcmTopicHelper::subscribeToTopic($tokens, "myTopic");

Unsubscribe

use Daldan26\Fcmv1\FcmTopicHelper;

$tokens = ["first token", ... , "last token"];
FcmTopicHelper::unsubscribeToTopic($tokens, "myTopic");

List subscriptions

use Daldan26\Fcmv1\FcmTopicHelper;

$token = "your awesome device token";
FcmTopicHelper::getTopicsByToken($token);

Notification

You can send notification to specific user or to topics.

Send to tokens

use Daldan26\Fcmv1\FcmNotification;

$notify = new FcmNotification();
$notify->setTitle("Title")->setBody("Message here")->setToken(["token_here"])->setClickAction("NEWS")->send();

Send to topic

use Daldan26\Fcmv1\FcmNotification;

$notify = new FcmNotification();
$notify->setTitle("Title")->setBody("Message here")->setTopic("general_topic")->setClickAction("NEWS")->send();

统计信息

  • 总下载量: 20
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-07-02

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固