PHP code example of digimantra / digi-notification
1. Go to this page and download the library: Download digimantra/digi-notification 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/ */
digimantra / digi-notification example snippets
### Use Namespaces
use DigiNotification\FcmHelper\FcmHelper;
### Assigning variables
$tokens = ['device_token_1', 'device_token_2']; // Array of device tokens to which the notification will be sent.
$title = 'New Notification'; // The title of the notification.
$body = 'This is the body of the notification'; // The body content of the notification.
$data = ['key' => 'value']; // (Optional) Additional custom data.
### Example Send FCM notificaiton Dispatch
FcmHelper::sendFcmNotification($tokens, $title, $body, $data);
bash
php artisan vendor:publish --tag=config --provider="DigiNotification\FcmHelper\FcmServiceProvider"