Skip to content

Commit a1c6c0b

Browse files
committed
add readme, change config parameter
1 parent cf880e8 commit a1c6c0b

File tree

4 files changed

+93
-3
lines changed

4 files changed

+93
-3
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name" : "kawankoding/fcm",
2+
"name" : "kawankoding/laravel-fcm",
33
"description" : "A package to send Firebase notification cross Laravel Application",
44
"authors" : [
55
{

readme.md

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# Laravel FCM
2+
3+
A Simple package that help you send a firebase notification with your laravel applications
4+
5+
### Installation
6+
7+
You can pull the package via composer :
8+
9+
``` bash
10+
$ composer require spatie/laravel-fractal
11+
```
12+
13+
Next, You must register the service provider :
14+
15+
``` php
16+
// config/app.php
17+
18+
'Providers' => [
19+
...
20+
Kawankoding\Fcm\Providers\FcmServiceProvider::class,
21+
]
22+
```
23+
24+
If you want to make use of the facade you must install it as well:
25+
26+
```php
27+
// config/app.php
28+
'aliases' => [
29+
...
30+
'Fcm' => Kawankoding\Fcm\Facades\Fcm::class,
31+
];
32+
```
33+
34+
Next, You must publish the config file to define your fcm server key :
35+
36+
```bash
37+
php artisan vendor:publish --provider="Kawankoding\Fcm\Providers\FcmServiceProvider"
38+
```
39+
40+
This is the contents of the published file:
41+
42+
```php
43+
return [
44+
45+
/*
46+
* Your Fcm Server Key
47+
* Change yo yours
48+
*/
49+
50+
'server_key' => '',
51+
52+
];
53+
```
54+
55+
### Usage
56+
57+
If You want to send a FCM with just notification parameter, this is an example of usage sending a FCM with only data parameter :
58+
```php
59+
fcm()
60+
->data([
61+
'title' => 'Test FCM',
62+
'body' => 'This is a test of FCM',
63+
])
64+
->push();
65+
```
66+
67+
If You want to send a FCM with just notification parameter,this is an example of usage sending a FCM with only notification parameter :
68+
```php
69+
fcm()
70+
->notification([
71+
'title' => 'Test FCM',
72+
'body' => 'This is a test of FCM',
73+
])
74+
->push();
75+
```
76+
77+
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 :
78+
```php
79+
fcm()
80+
->data([
81+
'title' => 'Test FCM',
82+
'body' => 'This is a test of FCM',
83+
])
84+
->notification([
85+
'title' => 'Test FCM',
86+
'body' => 'This is a test of FCM',
87+
])
88+
->push();
89+
```

resources/config/laravel-fcm.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
/**
66
* Set your FCM Server Key
7+
* Change yo yours
78
*/
89

9-
'server-key' => ''
10+
'server_key' => ''
1011
];

src/Kawankoding/Fcm/Fcm.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function push()
4545
'notification' => $this->notification
4646
];
4747

48-
$serverKey = config('laravel-fcm.server-key');
48+
$serverKey = config('laravel-fcm.server_key');
4949

5050
$headers = [
5151
'Authorization:key='.$serverKey,

0 commit comments

Comments
 (0)