PHP code example of daldan26 / fcmv1

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

    

daldan26 / fcmv1 example snippets


Daldan26\Fcmv1\FcmProvider::class,

use Daldan26\Fcmv1\FcmTopicHelper;

$tokens = ["first token", ... , "last token"];
FcmTopicHelper::subscribeToTopic($tokens, "myTopic");

use Daldan26\Fcmv1\FcmTopicHelper;

$tokens = ["first token", ... , "last token"];
FcmTopicHelper::unsubscribeToTopic($tokens, "myTopic");

use Daldan26\Fcmv1\FcmTopicHelper;

$token = "your awesome device token";
FcmTopicHelper::getTopicsByToken($token);


use Daldan26\Fcmv1\FcmNotification;

$notify = new FcmNotification();
$notify->setTitle("Title")->setBody("Message here")->setToken(["token_here"])->setClickAction("NEWS")->send();


use Daldan26\Fcmv1\FcmNotification;

$notify = new FcmNotification();
$notify->setTitle("Title")->setBody("Message here")->setTopic("general_topic")->setClickAction("NEWS")->send();


php artisan vendor:publish --tag=fcmv1 --ansi --force