1. Go to this page and download the library: Download lutskanu/php-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/ */
lutskanu / php-fcm example snippets
use paragraph1\phpFCM\Client;
use paragraph1\phpFCM\Message;
use paragraph1\phpFCM\Recipient\Device;
use paragraph1\phpFCM\Notification;
$note = new Notification('test title', 'testing body');
$note->setIcon('notification_icon_resource_name')
->setColor('#ffffff')
->setBadge(1);
$message = new Message();
$message->addRecipient(new Device('your-device-token'));
$message->setNotification($note)
->setData(array('someId' => 111));
$response = $client->send($message);
var_dump($response->getStatusCode());
use paragraph1\phpFCM\Client;
use paragraph1\phpFCM\Message;
use paragraph1\phpFCM\Recipient\Topic;
use paragraph1\phpFCM\Notification;
$message = new Message();
$message->addRecipient(new Topic('your-topic'));
$message->setNotification(new Notification('test title', 'testing body'))
->setData(array('someId' => 111));
$response = $client->send($message);
var_dump($response->getStatusCode());
composer
" "paragraph1/php-fcm": "*"
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.