1use Kreait\Firebase\Messaging\CloudMessage;
2
3$topic = 'a-topic';
4
5$message = CloudMessage::withTarget('topic', $topic)
6 ->withNotification($notification) // optional
7 ->withData($data) // optional
8;
9
10$message = CloudMessage::fromArray([
11 'topic' => $topic,
12 'notification' => [/* Notification data as array */], // optional
13 'data' => [/* data array */], // optional
14]);
15
16$messaging->send($message);