23 lines
837 B
PHP
23 lines
837 B
PHP
<?php
|
|
|
|
require __DIR__ . '/../../vendor/autoload.php';
|
|
|
|
use Fcm\FcmClient;
|
|
use Fcm\Push\Notification;
|
|
|
|
$api_token = 'AAAArpsiQbQ:APA91bHQVXxkUxNp3i2kviEmRDAnXKUyP0-Z5HZD15gV5V4TgidjmEiVVHilPnLffTW4u9txWkA_PPthTv7Baq8_wx99hr9Bx62q4JWrPsrfnNMeEw9w5ojPPu0eCOGOKHn_l1HoY_SJBS1n6DTt7IC0L14Kn33kmw';
|
|
$sender_id = 'AIzaSyD5gUUkXwaKarWYIigJGLLTzf9KQwoJ2wM';
|
|
|
|
// Instantiate the client with the project api_token and sender_id.
|
|
$client = new FcmClient($api_token, $sender_id);
|
|
|
|
// Instantiate the push notification request object.
|
|
$notification = new Notification();
|
|
|
|
// Enhance the notification object with our custom options.
|
|
$notification->addRecipient($device_id)
|
|
->setTitle('Motolite RES-Q')
|
|
->setBody('Test notification sending')
|
|
|
|
// Send the notification to the Firebase servers for further handling.
|
|
$client->send($notification);
|