Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/scthakuri/onesignal-send-notification
Simple PHP Library to list and send Push Notification with OneSignal Service
https://github.com/scthakuri/onesignal-send-notification
Last synced: about 2 months ago
JSON representation
Simple PHP Library to list and send Push Notification with OneSignal Service
- Host: GitHub
- URL: https://github.com/scthakuri/onesignal-send-notification
- Owner: scthakuri
- Created: 2022-03-18T11:47:42.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-03-18T14:10:10.000Z (almost 3 years ago)
- Last Synced: 2024-05-18T13:42:05.928Z (8 months ago)
- Language: PHP
- Homepage: https://packagist.org/packages/sureshchand/onesignal-notification
- Size: 3.91 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Simple PHP Library to list and send Push Notification with OneSignal Service
## Installation
```php
composer require sureshchand/onesignal-notification
```# Examples
### Initial Setup
```php
setBody('English Message')
->setSegments('All')
->prepare()
->send();
```
#### Send to a specific segment
```php
setBody('English Message')
->setSegments('Active Users')
->prepare()
->send();
```
#### Send based on filters/tags
```php
setBody('English Message')
->setFilter([
['field' => 'tag', 'key' => 'level', 'relation' => '>', 'value' => '10'],
['operator' => 'OR'],
['field' => 'amount_spent', 'relation' => '>', 'value' => '0']
])
->prepare()
->send();
```
#### Send based on OneSignal PlayerIds
```php
setBody('English Message')
->setPlayersId([
'PLAYER_ID',
'ANOTHER_PLAYER_ID'
])
->prepare()
->send();
```## Reference guideline
[OneSignal API Reference](https://documentation.onesignal.com/reference)