Skip to content

Issue with Setting fcmOptions in Firebase PHP SDK for Cloud Messaging #859

Closed Answered by erdman1
erdman1 asked this question in Q&A
Discussion options

You must be logged in to vote

Okay, so after further review I was finally able to get to the bottom of this.

The php code now looks like this:

        $messaging = $this->firebaseService->getMessaging();        
        $message = CloudMessage::withTarget('token', $token)
        ->withNotification(['title' => 'Title', 'body' => 'Body'])
        ->withWebPushConfig(WebPushConfig::fromArray([
            'notification' => [
                'title' => 'Title',
                'body' => 'Body',
                'icon' => 'icon.png'
            ],
            'fcm_options' => [
                'link' => 'http://localhost/test'
            ]
        ]));    
      
    
    $messaging->send($message);

my main "issue" was wi…

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by erdman1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants