如何在PHP中使用FCM HTTP v1 API [英] How to use the FCM HTTP v1 API with php
问题描述
我已经将FCM与旧版协议一起使用,但是找不到任何具体文档来将新的FCM HTTP v1 API与php一起使用.
I have used FCM with the legacy protocol but cannot find any concrete documentation to use the new FCM HTTP v1 API with php.
我已经成功导入了 Google API客户端库进入我的项目,但找不到有关如何获取fcm消息所需作用域的访问令牌的任何文档或教程.
I have managed to import the Google API Client Library into my project but cannot find any documentation or tutorials on how to obtain the access token for the required scopes for fcm messages.
推荐答案
If you are willing to use an existing library instead of implementing it yourself, you might consider having a look at https://github.com/kreait/firebase-php/ which has received support for FCM just today.
https://firebase-php.readthedocs.io/en /latest/cloud-messaging.html
如果不适合您,则至少可以从源代码中提取使用PHP与FCM REST API的连接.简而言之,它是 https://firebase.google的实现.com/docs/reference/fcm/rest/v1/projects.messages .
If it isn't for you, you will at least be able to extract the connections to the FCM REST API with PHP from the source code. In short, it's the implementation of https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages .
这篇关于如何在PHP中使用FCM HTTP v1 API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!