alideveloper49 / laravel-spf
dev-main
2022-02-27 11:56 UTC
Requires
- php: ^5.6|^7.0|^8.0
- illuminate/support: ^5.1|^6.0|^7.0|^8.0
This package is auto-updated.
Last update: 2024-09-27 17:31:38 UTC
README
Installation
You can pull the package via composer
$ composer require Alideveloper49/laravel-spf
Next, You must publish the config file to define your FCM server key :
$ php artisan vendor:publish --provider="Alideveloper49\Fcm\FcmServiceProvider"
This is the contents of the published file :
return [ /** * Set your FCM Server Key * Change to yours */ 'server_key' => env('FCM_SERVER_KEY', ''), ];
Set your FCM Server Key in .env file :
APP_NAME="Laravel" # ... FCM_SERVER_KEY=putYourKeyHere
Usage
If You want to send a FCM with just notification parameter, this is an example of usage sending a FCM with only data parameter :
$recipients = [ 'clKMv.......', 'GxQQW.......', ]; fcm() ->to($recipients) ->priority('high') ->timeToLive(0) ->data([ 'title' => 'Test FCM', 'body' => 'This is a test of FCM', ]) ->send();