You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+23-13Lines changed: 23 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -11,17 +11,18 @@ Before you start installing this service, please complete your OneSignal setup a
11
11
First, you'll need to require the package with Composer:
12
12
13
13
```sh
14
-
composer require Liliom/onesignal-laravel
14
+
composer require liliom/laravel-onesignal
15
15
```
16
16
17
-
Aftwards, run `composer update` from your command line.
18
17
19
-
Then, update`config/app.php` by adding an entry for the service provider.
18
+
Update your`config/app.php` by adding the following service provider.
20
19
21
20
```php
22
21
'providers' => [
23
22
// ...
24
-
Liliom\OneSignal\OneSignalServiceProvider::class
23
+
// ...
24
+
Liliom\OneSignal\OneSignalServiceProvider::class,
25
+
// ...
25
26
];
26
27
```
27
28
@@ -36,22 +37,25 @@ Then, register class alias by adding an entry in aliases section
36
37
```
37
38
38
39
39
-
Finally, from the command line again, run
40
+
Finally, publish the config file by running:
40
41
41
42
```
42
43
php artisan vendor:publish --tag=config
43
44
```
44
-
45
-
to publish the default configuration file.
46
-
This will publish a configuration file named `onesignal.php` which includes your OneSignal authorization keys.
47
-
48
-
> **Note:** If the previous command does not publish the config file successfully, please check the steps involving *providers* and *aliases* in the `config/app.php` file.
45
+
46
+
The command above shall publish a configuration file named `onesignal.php` which includes your OneSignal authorization keys.
49
47
50
48
51
49
## Configuration
52
50
53
-
You need to fill in `onesignal.php` file that is found in your applications `config` directory.
54
-
`app_id` is your *OneSignal App ID* and `rest_api_key` is your *REST API Key*.
51
+
Please fill the file `config/onesignal.php`.
52
+
`app_id` is your *OneSignal App ID* and `rest_api_key` is your *REST API Key*, where `user_auth_key` is optional.
53
+
54
+
Or alternatively you can fill your settings in `.env` file as the following:
55
+
```
56
+
ONE_SIGNAL_APP_ID=
57
+
ONE_SIGNAL_REST_API_KEY=
58
+
```
55
59
56
60
## Usage
57
61
@@ -68,7 +72,7 @@ You can easily send a message to all registered users with the command
68
72
69
73
You can send a message based on a set of tags with the command
@@ -80,6 +84,12 @@ After storing a user's tokens in a table, you can simply send a message with
80
84
`$userId` is the user's unique id where he/she is registered for notifications. Read https://documentation.onesignal.com/docs/web-push-tagging-guide for additional details.
81
85
`$url` , `$data` , `$buttons` and `$schedule` fields are exceptional. If you provide a `$url` parameter, users will be redirecting to that url.
82
86
87
+
### Sending a Notification To A Specific User via Email Address
88
+
89
+
If you are using the option to set the userId as email address of the user then use the following function
0 commit comments