@@ -6,22 +6,22 @@ A simple package that help you send a Firebase notification with your Laravel ap
66
77You can pull the package via composer :
88
9- ``` bash
9+ ``` bash
1010$ composer require kawankoding/laravel-fcm
1111```
1212
13- Next, You must register the service provider :
13+ Next, You must register the service provider :
1414
15- ``` php
15+ ``` php
1616// config/app.php
1717
1818'Providers' => [
19- // ...
20- Kawankoding\Fcm\FcmServiceProvider::class,
19+ // ...
20+ Kawankoding\Fcm\FcmServiceProvider::class,
2121]
22- ```
22+ ```
2323
24- If you want to make use of the facade you must install it as well :
24+ If you want to make use of the facade you must install it as well :
2525
2626``` php
2727// config/app.php
@@ -54,6 +54,7 @@ return [
5454```
5555
5656Set your FCM Server Key in ` .env ` file :
57+
5758```
5859APP_NAME="Laravel"
5960# ...
@@ -63,20 +64,24 @@ FCM_SERVER_KEY=putYourKeyHere
6364### Usage
6465
6566If You want to send a FCM with just notification parameter, this is an example of usage sending a FCM with only data parameter :
67+
6668``` php
6769fcm()
6870 ->to($recipients) // $recipients must an array
71+ ->priority('high')
6972 ->data([
7073 'title' => 'Test FCM',
7174 'body' => 'This is a test of FCM',
7275 ])
7376 ->send();
7477```
7578
76- If You want to send a FCM to topic, use method toTopic($topic) instead to() :
79+ If You want to send a FCM to topic, use method toTopic(\$ topic) instead to() :
80+
7781``` php
7882fcm()
7983 ->toTopic($topic) // $topic must an string (topic name)
84+ ->priority('normal')
8085 ->notification([
8186 'title' => 'Test FCM',
8287 'body' => 'This is a test of FCM',
8590```
8691
8792If You want to send a FCM with just notification parameter, this is an example of usage sending a FCM with only notification parameter :
93+
8894``` php
8995fcm()
9096 ->to($recipients) // $recipients must an array
97+ ->priority('high')
9198 ->notification([
9299 'title' => 'Test FCM',
93100 'body' => 'This is a test of FCM',
@@ -96,9 +103,11 @@ fcm()
96103```
97104
98105If You want to send a FCM with both data & notification parameter, this is an example of usage sending a FCM with both data & notification parameter :
106+
99107``` php
100108fcm()
101109 ->to($recipients) // $recipients must an array
110+ ->priority('normal')
102111 ->data([
103112 'title' => 'Test FCM',
104113 'body' => 'This is a test of FCM',
0 commit comments