Skip to content

Commit 04b91e8

Browse files
committed
chore: drop L5, support L6 and L7
1 parent 39b7544 commit 04b91e8

File tree

3 files changed

+1064
-243
lines changed

3 files changed

+1064
-243
lines changed

README.md

Lines changed: 24 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# OneSignal REST API Wrapper For Laravel/Lumen
1+
# OneSignal REST API Wrapper For Laravel/Lumen
22

33
## Introduction
44

5-
This project is a Laravel 5 / Lumen wrapper for the OneSignal REST API v1.
5+
This project is a Laravel 6+ / Lumen wrapper for the OneSignal REST API v1.
66
It supports all operations currently supported by the API.
77

88
## Installation (Laravel and Lumen)
@@ -14,37 +14,26 @@ composer require dreamonkey/laravel-onesignal-rest-api
1414
```
1515

1616
## Laravel Users:
17-
From Laravel 5.5 onwards, it's possible to take advantage of auto-discovery of the service provider.
1817

19-
For Laravel versions before 5.5, you must register the service provider in your config/app.php
20-
21-
Update `config/app.php` by adding the following entries.
22-
```php
23-
'providers' => [
24-
// ...
25-
Dreamonkey\OneSignal\OneSignalServiceProvider::class,
26-
];
27-
28-
'aliases' => [
29-
// ...
30-
'OneSignal' => Dreamonkey\OneSignal\Facades\OneSignal::class,
31-
];
32-
```
18+
Service provider will be auto-discovered.
3319

3420
## Lumen Users:
21+
3522
Update `bootstrap/app.php`, adding the following entry
23+
3624
```php
3725
$app->register( \Dreamonkey\OneSignal\OneSignalServiceProvider::class );
3826
class_alias( 'Dreamonkey\OneSignal\OneSignalFacade', 'OneSignal' );
3927
```
4028

41-
4229
## Configuration
30+
4331
There are three values that need to be set in order to use the library: your default OneSignal app ID, the REST API key and your account User Auth Key.
4432
All of these items can be found in your Control Panel on the OneSignal site.
4533
First two are app-related and can be found inside your app settings in the "Keys & IDs" tab (upper left corner), the third is account-related and can be found pressing your account avatar (lower right corner) and selecting "Account & API Keys".
4634

4735
Place the 3 keys into your .env file, as such:
36+
4837
```
4938
ONESIGNAL_APP_ID=
5039
ONESIGNAL_REST_API_KEY=
@@ -53,8 +42,9 @@ ONESIGNAL_USER_AUTH_KEY=
5342

5443
## Usage
5544

56-
There is a function for each of the OneSignal API calls. They are broken down here.
45+
There is a function for each of the OneSignal API calls. They are broken down here.
5746
All methods will return an array formatted like this:
47+
5848
```
5949
[
6050
'status' => < HTTP status code of the request >,
@@ -64,46 +54,48 @@ All methods will return an array formatted like this:
6454
]
6555
```
6656

67-
**Note:** In all instances where an $app_id is asked for, omitting it will grab the default OneSignal App ID specified in the .env file
57+
**Note:** In all instances where an \$app_id is asked for, omitting it will grab the default OneSignal App ID specified in the .env file
6858

6959
### Apps
7060

7161
##### getApps() - Get all Apps for the user
62+
7263
```
7364
$response = OneSignal::getApps();
7465
```
7566

76-
##### getApp( $app_id ) - Get the given App
67+
##### getApp( \$app_id ) - Get the given App
7768

78-
##### postapp( $data ) - Create a new App
69+
##### postapp( \$data ) - Create a new App
7970

8071
##### putApp( $app_id, $data ) - Update an App
8172

8273
### Players
8374

84-
##### getPlayers( $app_id, $limit, $offset ) - Get Players from an App
75+
##### getPlayers( $app_id, $limit, \$offset ) - Get Players from an App
8576

86-
##### getPlayer( $id ) - Get Player of the given ID
77+
##### getPlayer( \$id ) - Get Player of the given ID
8778

8879
##### postPlayer ( $data, $app_id ) - Add Player to an App
8980

9081
##### putPlayer( $data, $app_id ) - Update Player object for an App
9182

92-
##### postCSVExport( $app_id ) - Get a CSV dump of all Players for an App
83+
##### postCSVExport( \$app_id ) - Get a CSV dump of all Players for an App
9384

94-
##### postPlayerOnSession( $data ) - Start a new device session for this Player
85+
##### postPlayerOnSession( \$data ) - Start a new device session for this Player
9586

96-
##### postPlayerOnPurchase( $data ) - Track a new purchase for this Player
87+
##### postPlayerOnPurchase( \$data ) - Track a new purchase for this Player
9788

98-
##### postPlayerOnFocus( $data ) - Increment the Players total session length
89+
##### postPlayerOnFocus( \$data ) - Increment the Players total session length
9990

10091
### Notifications
10192

102-
##### getNotifications( $app_id, $limit, $offset ) - Get all Notifications for an App
93+
##### getNotifications( $app_id, $limit, \$offset ) - Get all Notifications for an App
10394

10495
##### getNotification( $id, $app_id ) - Get a Notification from an App
10596

10697
##### postNotification( $data, $app_id ) - Add a Notification to an App
98+
10799
```
108100
$response = OneSignal::postNotification([
109101
"tags" => [ ["key" => "myKey", "relation" => "=", "value" => 1 ] ],
@@ -112,16 +104,15 @@ $response = OneSignal::postNotification([
112104
]);
113105
```
114106

115-
##### putNotificationTrackOpen( $id, $app_id, $opened ) - Track whether a Notification was opened
107+
##### putNotificationTrackOpen( $id, $app_id, \$opened ) - Track whether a Notification was opened
116108

117109
##### deleteNotification( $id, $app_id ) - Delete a Notification from an App
118110

119-
120-
121111
## References
112+
122113
The official OneSignal API documentation is listed here:
123114
https://documentation.onesignal.com/docs/server-api-overview
124115

125-
126116
## Acknowledgements
117+
127118
This project has been forked and evolved by Dreamonkey from https://github.com/jmrieger/onesignal-laravel

composer.json

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
{
22
"name": "dreamonkey/laravel-onesignal-rest-api",
33
"description": "OneSignal REST API Wrapper For Laravel/Lumen",
4-
"keywords": ["onesignal", "webpush", "push", "laravel", "laravel 5", "lumen", "rest"],
4+
"keywords": [
5+
"onesignal",
6+
"webpush",
7+
"push",
8+
"laravel",
9+
"lumen",
10+
"rest"
11+
],
512
"type": "library",
613
"require": {
7-
"php": ">=5.5",
14+
"php": ">=7.2",
815
"guzzlehttp/guzzle": "^6.2",
9-
"illuminate/support": "4.*|5.*",
16+
"illuminate/support": "6.*|7.*",
1017
"symfony/psr-http-message-bridge": "^1.0.0"
1118
},
1219
"require-dev": {

0 commit comments

Comments
 (0)