Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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)