PHP code example of nasrul21 / php-fcm-client

1. Go to this page and download the library: Download nasrul21/php-fcm-client 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/ */

    

nasrul21 / php-fcm-client example snippets




// load composer
 = "..." // your fcm api key

// initialize FCMClient with apiKey as params
$fcm = new FCMClient($apiKey);

$registration_ids = ["...", "..."];
$title = "Hello!";
$body = "This is the body";

// send fcm notifications
$fcm->send($registration_ids, $title, $body);
bash
composer