fcm/firebase_cloud_messaging

dev-main 2022-06-23 15:53 UTC

This package is auto-updated.

Last update: 2024-09-23 20:53:51 UTC


README

此库允许与Firebase云消息传递集成

要求

  • PHP >=7.2

安装

php composer.phar require fcm/firebase_cloud_messaging:dev-main 或 composer require fcm/firebase_cloud_messaging:dev-main

代码示例

use Fcm\PushNotification;
// Create an instance of the class PushNotification
$fcm = new PushNotification('tokenServer');

// resize image instance
$fcm->sendMessage("clientToken", "New Notification", "message", "https://amappzing.com.br/bundles/app/backend/img/favicon.png", ['body' => 'sending a message'])

// check if the client token is active
$fcm->validateClientToken('clientToken');

// serverToken ==> After the firebase account is created and configured, the token that it returns is the one that should be used here
// clientToken ==> After firebase is configured on the mobile device or the website in charge of displaying push notifications, they will return a token, this will be the one that should be used here