Skip to content

Commit dd94cb2

Browse files
committed
2 parents 0767d46 + 01bd91d commit dd94cb2

File tree

1 file changed

+23
-13
lines changed

1 file changed

+23
-13
lines changed

README.md

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,18 @@ Before you start installing this service, please complete your OneSignal setup a
1111
First, you'll need to require the package with Composer:
1212

1313
```sh
14-
composer require Liliom/onesignal-laravel
14+
composer require liliom/laravel-onesignal
1515
```
1616

17-
Aftwards, run `composer update` from your command line.
1817

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.
2019

2120
```php
2221
'providers' => [
2322
// ...
24-
Liliom\OneSignal\OneSignalServiceProvider::class
23+
// ...
24+
Liliom\OneSignal\OneSignalServiceProvider::class,
25+
// ...
2526
];
2627
```
2728

@@ -36,22 +37,25 @@ Then, register class alias by adding an entry in aliases section
3637
```
3738

3839

39-
Finally, from the command line again, run
40+
Finally, publish the config file by running:
4041

4142
```
4243
php artisan vendor:publish --tag=config
4344
```
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.
4947

5048

5149
## Configuration
5250

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+
```
5559

5660
## Usage
5761

@@ -68,7 +72,7 @@ You can easily send a message to all registered users with the command
6872

6973
You can send a message based on a set of tags with the command
7074

71-
OneSignal::sendNotificationUsingTags("Some Message", array("key" => "device_uuid", "relation" => "=", "value" => 123e4567-e89b-12d3-a456-426655440000), $url = null, $data = null, $buttons = null, $schedule = null);
75+
OneSignal::sendNotificationUsingTags("Some Message", ["key" => "device_uuid", "relation" => "=", "value" => 123e4567-e89b-12d3-a456-426655440000], $url = null, $data = null, $buttons = null, $schedule = null);
7276

7377

7478
### Sending a Notification To A Specific User
@@ -80,6 +84,12 @@ After storing a user's tokens in a table, you can simply send a message with
8084
`$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.
8185
`$url` , `$data` , `$buttons` and `$schedule` fields are exceptional. If you provide a `$url` parameter, users will be redirecting to that url.
8286

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
90+
91+
OneSignal::sendNotificationToUserByEmail("Some Message", $email, $filters = [], $segment = ['All'], $url = null, $data = null, $buttons = null, $schedule = null, $smallIcon = null, $LargeIcon = null, $bigPicture = null, $androidAccentCircleColor = null, $androidAccentLedColor = null, $sound = null )
92+
8393

8494
### Sending a Notification To Segment
8595

0 commit comments

Comments
 (0)