All Projects → namnv609 → php-onesignal-sdk

namnv609 / php-onesignal-sdk

Licence: other
PHP SDK for OneSignal RESTful API

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to php-onesignal-sdk

EasyBuzzer
The Beep Library For Arduino
Stars: ✭ 63 (+231.58%)
Mutual labels:  notifications
csgo-rcon-nodejs
A web panel to control a CS:GO server
Stars: ✭ 46 (+142.11%)
Mutual labels:  notifications
wearable
Android Wear/ Wear OS Examples
Stars: ✭ 67 (+252.63%)
Mutual labels:  notifications
webpush-example
A basic push notifications app built on Laravel and Vanilla Javascript.
Stars: ✭ 26 (+36.84%)
Mutual labels:  notifications
PUSHTestFCM
[FireMonkey] Push test project
Stars: ✭ 17 (-10.53%)
Mutual labels:  notifications
react-native-open-notification
www.npmjs.com/package/react-native-open-notification
Stars: ✭ 23 (+21.05%)
Mutual labels:  notifications
iterable-android-sdk
Iterable's Android SDK. Receive and track pushes to Iterable from your Android app.
Stars: ✭ 19 (+0%)
Mutual labels:  notifications
PushMeBaby
iOS Push Notification Debug App. You can use this app during iOS Push Notification (development or production) to push notifications on your device from your Mac.
Stars: ✭ 47 (+147.37%)
Mutual labels:  notifications
Dracker
An iOS and React App to track debt and send/receive payments.
Stars: ✭ 22 (+15.79%)
Mutual labels:  notifications
Graphical notifications Zabbix
No description or website provided.
Stars: ✭ 77 (+305.26%)
Mutual labels:  notifications
swift-sdk
Iterable's iOS SDK. Receive and track pushes to Iterable from your iOS app.
Stars: ✭ 65 (+242.11%)
Mutual labels:  notifications
ember-cli-new-version
A convention based update notification for Ember. With this addon, you can detect a new version and notify the user to refresh the page
Stars: ✭ 22 (+15.79%)
Mutual labels:  notifications
corpwechatbot
企业微信的python封装接口,简易上手,开箱即用,一行代码实现消息推送。A more convenient python wrapper interface of corpwechat(wework, wecom) official API, use only one line of code to send your messages to your corpwechat(wework, wecom) .
Stars: ✭ 119 (+526.32%)
Mutual labels:  notifications
stack-exchange-notifications
Add-ons for Stack Exchange sites, like: askdifferent, askubuntu, serverfault, stackoverflow and superuser
Stars: ✭ 21 (+10.53%)
Mutual labels:  notifications
fluffychat
+++++Moved to GitLab+++++
Stars: ✭ 47 (+147.37%)
Mutual labels:  notifications
New-AdPasswordReminder
PowerShell script to email users that their password is soon expiring, along with info on how to change it. Designed to run as a scheduled task on a machine with the Active Directory PowerShell module installed.
Stars: ✭ 20 (+5.26%)
Mutual labels:  notifications
cloud-build-notifiers
Notifier images for Cloud Build, complete with build status filtering and Google Secret Manager integration
Stars: ✭ 79 (+315.79%)
Mutual labels:  notifications
github-label-notify
📫 Get notified about new issues with specific label
Stars: ✭ 18 (-5.26%)
Mutual labels:  notifications
spontit-api-python-wrapper
Send functional, flexible push notifications to iOS, Android, and desktop devices (without your own app or website).
Stars: ✭ 35 (+84.21%)
Mutual labels:  notifications
homely
🏠 - A bunch of mosquittos. IoT wiring and notification framework, with an unix style.
Stars: ✭ 15 (-21.05%)
Mutual labels:  notifications

PHP SDK for OneSignal RESTful API

OneSignal is a high volume and reliable push notification service for websites and mobile applications. We support all major native and mobile platforms by providing dedicated SDKs for each platform, a RESTful server API, and an online dashboard for marketers to design and send push notifications.

System requirements

  • PHP >= 5.5

Installation

Using Composer composer require namnv609/php-onesignal-sdk or you can include the following in your composer.json "namnv609/php-onesignal-sdk": "1.0"

Response format

{"status":true,"code":200,"response":<OneSignal result>}
$players = $player->all();

foreach ($players->response->players as $player) {
    echo $player->id . PHP_EOL;
}

Usage Instructions

First, create a new OneSignal instance to make configuring the library for usage.

use NNV\OneSignal\OneSignal;

$oneSignal = new OneSignal(<User Auth key> [, <App ID>, <App REST key>, <Extra options for GuzzleHttp Client>])

Once the OneSignal instance has been registered. You may use it like so:

Application

Application body parameters: Create and Update

use NNV\OneSignal\API\App;

$app = new App($oneSignal);
  • View apps
$app->all();
  • View an app
$app->get("<App ID>");
  • Create an app
$appData = [
    'name' => '<App name>',
    'apns_env' => 'sandbox',
];

$app->create($appData);
  • Update an app
$appData = [
    'apns_env' => 'production',
];

$app->update("<App ID>", $appData);

Player (Device)

Player (Device) body parameters: Create, Update, New session, New purchase, Increment session length and CSV export

use NNV\OneSignal\API\Player;

$player = new Player($oneSignal [, <App ID>, <App REST key>]);
  • View devices
$player->all([<Limit>, <Offset>]);
  • View device
$player->get("<Player ID>");
  • Add a device
use NNV\OneSignal\Constants\DeviceTypes;

$playerData = [
    'language' => 'en',
    'tags' => [
        'for' => 'bar',
        'this' => 'that'
    ]
];

$player->create(DeviceTypes::CHROME_WEBSITE, $playerData);
  • Edit device
use NNV\OneSignal\Constants\NotificationTypes;
use NNV\OneSignal\Constants\TestTypes;

$playerData = [
    'test_type' => TestTypes::DEVELOPMENT,
    'notification_types' => NotificationTypes::UNSUBSCRIBED
];

$player->update("<Player ID>", $playerData);
  • New session
$sessionData = [
    'tags' => [
        'new' => 'session',
    ],
];
$player->onSession("<Player ID>", $sessionData);
  • New purchase (Currently, i've support one item per request)
$purchaseData = [
    'sku' => 'SKU123',
    'iso' => 'USD',
    'amount' => '0.99',
];

$player->onPurchase("<Player ID>", $purchaseData, [<Is existing>]);
  • Increment session length
$focusData = [
    'state' => 'ping',
    'active_time' => 1,
];

$player->onFocus("<App ID>", $focusData);
  • CSV export
$extraFields = ['rooted'];

$player->csvExport($extraFields);

Notification

Notification body parameters: Create

use NNV\OneSignal\API\Notification;

$notification = new Notification($oneSignal[, <App ID>, <App REST key>]);
  • Create notification
$notificationData = [
    'included_segments' => ['All'],
    'contents' => [
        'en' => 'Hello, world',
    ],
    'headings' => [
        'en' => 'Hello',
    ],
    'buttons' => [
        [
            'id' => 'button_id',
            'text' => 'Button text',
            'icon' => 'button_icon',
        ],
    ],
    'filters' => [
        [
            'field' => 'tag',
            'key' => 'level',
            'relation' => '>',
            'value' => '10',
        ],
    ],
    'send_after' => 'Sep 24 2017 14:00:00 GMT-0700',
    'isChromeWeb' => true,
];

$notification->create($notificationData);
  • Cancel notification
$notification->cancel("<Notification ID>");
  • View notification
$notification->get("<Notification ID>");
  • View notifications
$notification->all([<Limit>, <Offset>]);
  • Track open
$notification->trackOpen("<Notification ID>");
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].