PHPackages                             namnv609/php-onesignal-sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. namnv609/php-onesignal-sdk

AbandonedArchivedLibrary[Mail &amp; Notifications](/categories/mail)

namnv609/php-onesignal-sdk
==========================

PHP SDK for OneSignal RESTful API

v1.0.1(9y ago)1957.6k↓39.8%7[3 issues](https://github.com/namnv609/php-onesignal-sdk/issues)[1 PRs](https://github.com/namnv609/php-onesignal-sdk/pulls)1MITPHPPHP &gt;=5.5

Since Jan 25Pushed 5y ago1 watchersCompare

[ Source](https://github.com/namnv609/php-onesignal-sdk)[ Packagist](https://packagist.org/packages/namnv609/php-onesignal-sdk)[ RSS](/packages/namnv609-php-onesignal-sdk/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (2)Dependencies (5)Versions (3)Used By (1)

PHP SDK for OneSignal RESTful API
=================================

[](#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
-------------------

[](#system-requirements)

- **PHP &gt;= 5.5**

Installation
------------

[](#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

[](#response-format)

```
{"status":true,"code":200,"response":}
```

- `status`: Boolean. `true` or `false` (status code is 200 or otherwise)
- `code`: Integer. Status code
- `response`: Mixed. You can view OneSignal result detail for each API at:

```
$players = $player->all();

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

Usage Instructions
------------------

[](#usage-instructions)

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

```
use NNV\OneSignal\OneSignal;

$oneSignal = new OneSignal( [, , , ])
```

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

### [Application](http://namnv609.github.io/php-onesignal-sdk/class-NNV.OneSignal.API.App.html)

[](#application)

Application body parameters: [**Create**](https://documentation.onesignal.com/reference#create-an-app) and [**Update**](https://documentation.onesignal.com/reference#update-an-app)

```
use NNV\OneSignal\API\App;

$app = new App($oneSignal);
```

- View apps

```
$app->all();
```

- View an app

```
$app->get("");
```

- Create an app

```
$appData = [
    'name' => '',
    'apns_env' => 'sandbox',
];

$app->create($appData);
```

- Update an app

```
$appData = [
    'apns_env' => 'production',
];

$app->update("", $appData);
```

### [Player (Device)](http://namnv609.github.io/php-onesignal-sdk/class-NNV.OneSignal.API.Player.html)

[](#player-device)

Player (Device) body parameters: [**Create**](https://documentation.onesignal.com/reference#add-a-device), [**Update**](https://documentation.onesignal.com/reference#edit-device), [**New session**](https://documentation.onesignal.com/reference#new-session), [**New purchase**](https://documentation.onesignal.com/reference#new-purchase), [**Increment session length**](https://documentation.onesignal.com/reference#increment-session-length) and [**CSV export**](https://documentation.onesignal.com/reference#csv-export)

```
use NNV\OneSignal\API\Player;

$player = new Player($oneSignal [, , ]);
```

- View devices

```
$player->all([, ]);
```

- View device

```
$player->get("");
```

- 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("", $playerData);
```

- New session

```
$sessionData = [
    'tags' => [
        'new' => 'session',
    ],
];
$player->onSession("", $sessionData);
```

- New purchase (Currently, i've support one item per request)

```
$purchaseData = [
    'sku' => 'SKU123',
    'iso' => 'USD',
    'amount' => '0.99',
];

$player->onPurchase("", $purchaseData, []);
```

- Increment session length

```
$focusData = [
    'state' => 'ping',
    'active_time' => 1,
];

$player->onFocus("", $focusData);
```

- CSV export

```
$extraFields = ['rooted'];

$player->csvExport($extraFields);
```

### [Notification](http://namnv609.github.io/php-onesignal-sdk/class-NNV.OneSignal.API.Notification.html)

[](#notification)

Notification body parameters: [**Create**](https://documentation.onesignal.com/reference#create-notification)

```
use NNV\OneSignal\API\Notification;

$notification = new Notification($oneSignal[, , ]);
```

- 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("");
```

- View notification

```
$notification->get("");
```

- View notifications

```
$notification->all([, ]);
```

- Track open

```
$notification->trackOpen("");
```

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity39

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 92.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~159 days

Total

2

Last Release

3288d ago

PHP version history (2 changes)v1.0PHP &gt;=5.4

v1.0.1PHP &gt;=5.5

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8691772?v=4)[NamNV609](/maintainers/namnv609)[@namnv609](https://github.com/namnv609)

---

Top Contributors

[![namnv609](https://avatars.githubusercontent.com/u/8691772?v=4)](https://github.com/namnv609 "namnv609 (26 commits)")[![sanderjongsma](https://avatars.githubusercontent.com/u/2726055?v=4)](https://github.com/sanderjongsma "sanderjongsma (1 commits)")[![TheWildHorse](https://avatars.githubusercontent.com/u/3526915?v=4)](https://github.com/TheWildHorse "TheWildHorse (1 commits)")

---

Tags

notificationsonesignal-phpphp-sdkweb-push-notification

### Embed Badge

![Health badge](/badges/namnv609-php-onesignal-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/namnv609-php-onesignal-sdk/health.svg)](https://phpackages.com/packages/namnv609-php-onesignal-sdk)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k5.9M738](/packages/sylius-sylius)[typo3/cms

TYPO3 CMS is a free open source Content Management Framework initially created by Kasper Skaarhoj and licensed under GNU/GPL.

1.2k1.9M122](/packages/typo3-cms)[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k656.1k38](/packages/neuron-core-neuron-ai)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.6M574](/packages/shopware-core)[guanguans/notify

Push notification SDK(AnPush、Bark、Chanify、DingTalk、Discord、Gitter、GoogleChat、IGot、Lark、Mattermost、MicrosoftTeams、NotifyX、NowPush、Ntfy、Push、Pushback、PushBullet、PushDeer、PushMe、Pushover、PushPlus、QQ、RocketChat、ServerChan、ShowdocPush、SimplePush、Slack、Telegram、WeWork、WPush、XiZhi、YiFengChuanHua、ZohoCliq、ZohoCliqWebHook、Zulip).

687114.3k8](/packages/guanguans-notify)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3741.3M46](/packages/tencentcloud-tencentcloud-sdk-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
