PHP code example of michalper / firebase_cloud_messaging_client

1. Go to this page and download the library: Download michalper/firebase_cloud_messaging_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/ */

    

michalper / firebase_cloud_messaging_client example snippets


$client = new FireBaseClient();
$client->setApiKey('...');

$message = (new Message())
    ->setTo($deviceToken)
    ->setPriority('high')
    ->setNotification((new Notification())->setTitle('...')->setBody('...'))
    ->setData(['score' => '3x1']);

$response = $client->message->send($message);