PHPackages                             kodjunkie/onesignal-php-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. kodjunkie/onesignal-php-sdk

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

kodjunkie/onesignal-php-sdk
===========================

OneSignal SDK for PHP developers with fluent API and supports Laravel / Lumen out of the box.

v1.1.6(1y ago)42.2k↓50%3MITPHPPHP ^7.0|^8.0CI passing

Since Aug 11Pushed 1y ago1 watchersCompare

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

READMEChangelog (10)Dependencies (4)Versions (19)Used By (0)

 [![OneSignal](./onesignal.png)](./onesignal.png)

OneSignal PHP SDK
=================

[](#onesignal-php-sdk)

OneSignal SDK for PHP developers with fluent API and supports Laravel / Lumen out of the box.

[![Latest Stable Version](https://camo.githubusercontent.com/df888d7fc4b9f6cca2b42fb88b75bdd6bb59ff04db9467d2e0ceb818ba3af1b2/687474703a2f2f706f7365722e707567782e6f72672f6b6f646a756e6b69652f6f6e657369676e616c2d7068702d73646b2f76)](https://packagist.org/packages/kodjunkie/onesignal-php-sdk) [![PHP Version Require](https://camo.githubusercontent.com/44bb4a9240d4ca9ec9da71abe9ccd4c4d5fe42d9993729cdc6a0d4847251a1c3/687474703a2f2f706f7365722e707567782e6f72672f6b6f646a756e6b69652f6f6e657369676e616c2d7068702d73646b2f726571756972652f706870)](https://packagist.org/packages/kodjunkie/onesignal-php-sdk) [![Total Downloads](https://camo.githubusercontent.com/854d53fd3de1939d64be4d4a127707cb8b6b529ac28f2d8c6de9e5a523f92ffe/687474703a2f2f706f7365722e707567782e6f72672f6b6f646a756e6b69652f6f6e657369676e616c2d7068702d73646b2f646f776e6c6f616473)](https://packagist.org/packages/kodjunkie/onesignal-php-sdk) [![tests](https://github.com/kodjunkie/onesignal-php-sdk/actions/workflows/php.yml/badge.svg?branch=master)](https://github.com/kodjunkie/onesignal-php-sdk/actions/workflows/php.yml) [![license: MIT](https://camo.githubusercontent.com/4141875b9db06b6e19ee4c8c4f14f34b47dabb4fcdad7816e338a79666b0aacb/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d7265642e737667)](https://github.com/kodjunkie/onesignal-php-sdk/blob/master/LICENSE)

- How to use this package? [Click here](https://github.com/kodjunkie/onesignal-php-sdk/tree/master/docs)
- For the official documentation [click here](https://documentation.onesignal.com/reference)

Why use this package?
---------------------

[](#why-use-this-package)

> This is the only package out there that is a breeze to set up, and have a fluent / standardized API across endpoints.

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

[](#installation)

**NOTE:** For `laravel` users, this package registers itself automatically.

```
composer require kodjunkie/onesignal-php-sdk
```

### Usage in plain PHP

[](#usage-in-plain-php)

```
use Kodjunkie\OnesignalPhpSdk\OneSignal;
use Kodjunkie\OnesignalPhpSdk\Exceptions\OneSignalException;

$config = [
    // Onesignal API Key
    'api_key' => '',
    // Onesignal Auth Key
    'auth_key' => '',
    // Onesignal App ID (optional)
    // this is beneficial if you're working with a single OneSignal app
    // so, you could pass "null" to methods / functions that requires it.
    'app_id' => '',
];

try {
    // Initialize the SDK
    $oneSignal = new OneSignal($config);

    // Using the API
    // Get all apps
    $response = $oneSignal->app()->getAll();

    // Use json_decode() to get the response as an stdClass object
    var_dump($response);
} catch (OneSignalException $exception) {
    var_dump($exception->getMessage());
}
```

### Usage in Laravel / Lumen

[](#usage-in-laravel--lumen)

Set these values in your `.env` file

```
ONESIGNAL_API_KEY=
ONESIGNAL_AUTH_KEY=
ONESIGNAL_APP_ID=
```

#### Register the service provider (lumen only)

[](#register-the-service-provider-lumen-only)

Add this line to your `bootstrap/app.php` file

```
$app->register(Kodjunkie\OnesignalPhpSdk\OneSignalServiceProvider::class);

// Register the facade (optional)
// To use, must uncomment $app->withFacades()
if (!class_exists('OneSignal')) {
    class_alias(Kodjunkie\OnesignalPhpSdk\Facade::class, 'OneSignal');
}
```

#### Code samples

[](#code-samples)

```
use Kodjunkie\OnesignalPhpSdk\Exceptions\OneSignalException;

try {
    // Initialize the SDK
    // Resolve from the IoC container
    $oneSignal = app()->make('onesignal');

    // Using the API
    // Get all devices
    $response = $oneSignal->device()->getAll($appId, $limit, $offset);

    // Using the facade, the code above will look like this
    // with "app_id" provided in the config
    $response = OneSignal::device()->getAll(null, $limit, $offset);

    dd($response);
} catch (OneSignalException $exception) {
    dd($exception->getMessage());
}
```

Tests
-----

[](#tests)

```
composer test
```

License
-------

[](#license)

This project is opened under the [MIT 2.0 License](https://github.com/kodjunkie/onesignal-php-sdk/blob/master/LICENSE)which allows very broad use for both academic and commercial purposes.

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance43

Moderate activity, may be stable

Popularity25

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~80 days

Recently: every ~228 days

Total

17

Last Release

451d ago

PHP version history (3 changes)v1.0.0PHP &gt;=7.3

v1.0.1PHP ^7.2|^8.0

v1.0.7PHP ^7.0|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/e8808d4913bfca861d5698024234428c1b4db3c9ff672e7c2ff3944171b74d01?d=identicon)[kodjunkie](/maintainers/kodjunkie)

---

Top Contributors

[![kodjunkie](https://avatars.githubusercontent.com/u/21959017?v=4)](https://github.com/kodjunkie "kodjunkie (212 commits)")

---

Tags

apiapnsfcmgcmlaravellaravel-packagelumenlumen-packagenotificationsonesignalonesignal-apionesignal-phponesignal-sdkphpphp-libraypush-notificationrest-clientrestful-apisdkwebpushphpapilaravelsdkpushlumensignalnotificationgcmFCMfluentWebPushdeveloperonesignalapnsnotifyone

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

PHPackages © 2026

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