1. Go to this page and download the library: Download erickskrauch/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/ */
erickskrauch / fcm example snippets
use ErickSkrauch\Fcm\Client;
use ErickSkrauch\Fcm\Message\Message;
use ErickSkrauch\Fcm\Message\Notification;
use ErickSkrauch\Fcm\Recipient\Device;
$client = new Client('YOUR SERVER KEY');
$notification = new Notification(, 'testing body');
$notification->setTitle('Wow, something happened...');
$notification->setBody('It just works!');
$message = new Message();
$message->setNotification($notification);
$message->setCollapseKey('collapse.key');
$recipient = new Device('your-device-token');
$result = $client->send($message, $recipient);
use ErickSkrauch\Fcm\Recipient\Recipient;
class MyComplexCondition implements Recipient {
public function getConditionParam(): string{
return Recipient::PARAM_CONDITION;
}
public function getConditionValue(): string {
return "'TopicA' in topics && ('TopicB' in topics || 'TopicC' in topics)";
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.