PHP code example of idstack / laravel-fcm

1. Go to this page and download the library: Download idstack/laravel-fcm 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/ */

    

idstack / laravel-fcm example snippets


'aliases' => [
    ...
    'Fcm' => Idstack\Fcm\Facades\Fcm::class,
];

return [
    /**
     * Insert your FCM Server Key Here
     * Or you can add in env file with FCM_SERVER_KEY variable
     */
    'fcm_server_key' => env('FCM_SERVER_KEY','')
];


fcm()
    ->data([
        'title' => 'Test FCM',
        'body' => 'This is a test of FCM',
    ])
    ->to($recipients); // $recipients must an array

fcm()
    ->data([
        'title' => 'Test FCM',
        'body' => 'This is a test of FCM',
    ])
    ->toTopics($recipients); // $recipients must an array
 php
'Providers' => [
    ...
    Idstack\Fcm\FcmServiceProvider::class,
]
 
bash
php artisan vendor:publish --provider="Idstack\Fcm\FcmServiceProvider"