PHP code example of elmogy / fcm

1. Go to this page and download the library: Download elmogy/fcm library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

elmogy / fcm example snippets


use elmogy\fcm\FCMService;

 $fcmService = new FCMService();

    use elmogy\fcm\FCMService;

    $fcmService = new FCMService();

    $fcmToken = "DEVICE_TOKEN"; // Replace with the actual FCM token
    $title = "Test Notification";
    $body = "This is a test message.";
    $data = " ['key' => 'value']"; // Optional

    $response = $fcmService->sendFCM($fcmToken, $title, $body , $data);