@@ -6,22 +6,22 @@ A simple package that help you send a Firebase notification with your Laravel ap
6
6
7
7
You can pull the package via composer :
8
8
9
- ``` bash
9
+ ``` bash
10
10
$ composer require kawankoding/laravel-fcm
11
11
```
12
12
13
- Next, You must register the service provider :
13
+ Next, You must register the service provider :
14
14
15
- ``` php
15
+ ``` php
16
16
// config/app.php
17
17
18
18
'Providers' => [
19
- // ...
20
- Kawankoding\Fcm\FcmServiceProvider::class,
19
+ // ...
20
+ Kawankoding\Fcm\FcmServiceProvider::class,
21
21
]
22
- ```
22
+ ```
23
23
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 :
25
25
26
26
``` php
27
27
// config/app.php
@@ -54,6 +54,7 @@ return [
54
54
```
55
55
56
56
Set your FCM Server Key in ` .env ` file :
57
+
57
58
```
58
59
APP_NAME="Laravel"
59
60
# ...
@@ -63,20 +64,24 @@ FCM_SERVER_KEY=putYourKeyHere
63
64
### Usage
64
65
65
66
If You want to send a FCM with just notification parameter, this is an example of usage sending a FCM with only data parameter :
67
+
66
68
``` php
67
69
fcm()
68
70
->to($recipients) // $recipients must an array
71
+ ->priority('high')
69
72
->data([
70
73
'title' => 'Test FCM',
71
74
'body' => 'This is a test of FCM',
72
75
])
73
76
->send();
74
77
```
75
78
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
+
77
81
``` php
78
82
fcm()
79
83
->toTopic($topic) // $topic must an string (topic name)
84
+ ->priority('normal')
80
85
->notification([
81
86
'title' => 'Test FCM',
82
87
'body' => 'This is a test of FCM',
85
90
```
86
91
87
92
If You want to send a FCM with just notification parameter, this is an example of usage sending a FCM with only notification parameter :
93
+
88
94
``` php
89
95
fcm()
90
96
->to($recipients) // $recipients must an array
97
+ ->priority('high')
91
98
->notification([
92
99
'title' => 'Test FCM',
93
100
'body' => 'This is a test of FCM',
@@ -96,9 +103,11 @@ fcm()
96
103
```
97
104
98
105
If 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
+
99
107
``` php
100
108
fcm()
101
109
->to($recipients) // $recipients must an array
110
+ ->priority('normal')
102
111
->data([
103
112
'title' => 'Test FCM',
104
113
'body' => 'This is a test of FCM',
0 commit comments