kreit cloud messaging with token array php code example
Example: kreit cloud messaging with token array php
use Kreait\Firebase\Messaging\CloudMessage;
$topic = 'a-topic';
$message = CloudMessage::withTarget('topic', $topic)
->withNotification($notification) // optional
->withData($data) // optional
;
$message = CloudMessage::fromArray([
'topic' => $topic,
'notification' => [/* Notification data as array */], // optional
'data' => [/* data array */], // optional
]);
$messaging->send($message);