PHPackages                             jmrieger/onesignal-laravel - 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. jmrieger/onesignal-laravel

ActiveLibrary

jmrieger/onesignal-laravel
==========================

OneSignal Push Wrapper For Illuminate

1.1.1(6y ago)2518.3k↓100%9[6 issues](https://github.com/jmrieger/onesignal-laravel/issues)MITPHPPHP &gt;=5.5CI failing

Since Jun 6Pushed 6y ago4 watchersCompare

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

READMEChangelog (9)Dependencies (4)Versions (11)Used By (0)

OneSignal Push Notifications for Laravel 5
==========================================

[](#onesignal-push-notifications-for-laravel-5)

WARNING!
========

[](#warning)

This project is not actively maintained as of 2018/12/12. I'd strongly urge you to consider a package that is, like `berkayk/onesignal-laravel`

Introduction
------------

[](#introduction)

This project is a wrapper for the OneSignal v1 API. It supports all operations currently supported by the API.

Installation (Laravel and Lumen)
--------------------------------

[](#installation-laravel-and-lumen)

Require the package with composer.

```
composer require jmrieger/onesignal-laravel
composer update
```

Laravel Users:
--------------

[](#laravel-users)

Update `config/app.php` by adding the following entries.

```
'providers' => [
	// ...
	jmrieger\OneSignal\OneSignalServiceProvider::class
];

'aliases' => [
   	// ...
   	'OneSignal' => jmrieger\OneSignal\OneSignalFacade::class
   ];
```

Lumen Users:
------------

[](#lumen-users)

update `bootstrap/app.php`, adding the following entry

```
$app->register( \jmrieger\OneSignal\OneSignalServiceProvider::class );
class_alias( 'jmrieger\OneSignal\OneSignalFacade', 'OneSignal' );
```

Configuration
-------------

[](#configuration)

There are 3 settings that need to be updated: your default OneSignal app ID, the REST API key, and the User Auth Key. All of these items can be found in your Control Panel on the OneSignal site.

First, publish the onesignal config:

```
php artisan vendor:publish

```

Place the 3 keys into your .env file, as such:

```
ONESIGNAL_APP_ID=
ONESIGNAL_REST_API_KEY=
ONESIGNAL_USER_AUTH_KEY=

```

Usage
-----

[](#usage)

There is a function for each of the OneSignal API calls. They are broken down here.

**Note:** In all instances where an $app\_id is asked for, omitting it will grab the default OneSignal App ID specified in the .env file

### Apps

[](#apps)

##### getApps() - Get all Apps for the user

[](#getapps---get-all-apps-for-the-user)

```
$response = OneSignal::getApps();

```

##### getApp( $app\_id ) - Get the given App

[](#getapp-app_id----get-the-given-app)

##### postapp( $data ) - Create a new App

[](#postapp-data----create-a-new-app)

##### putApp( $app\_id, $data ) - Update an App

[](#putapp-app_id-data----update-an-app)

### Players

[](#players)

##### getPlayers( $app\_id, $limit, $offset ) - Get Players from an App

[](#getplayers-app_id-limit-offset----get-players-from-an-app)

##### getPlayer( $id ) - Get Player of the given ID

[](#getplayer-id----get-player-of-the-given-id)

##### postPlayer ( $data, $app\_id ) - Add Player to an App

[](#postplayer--data-app_id----add-player-to-an-app)

##### putPlayer( $data, $app\_id ) - Update Player object for an App

[](#putplayer-data-app_id----update-player-object-for-an-app)

##### postCSVExport( $app\_id ) - Get a CSV dump of all Players for an App

[](#postcsvexport-app_id----get-a-csv-dump-of-all-players-for-an-app)

##### postPlayerOnSession( $data ) - Start a new device session for this Player

[](#postplayeronsession-data----start-a-new-device-session-for-this-player)

##### postPlayerOnPurchase( $data ) - Track a new purchase for this Player

[](#postplayeronpurchase-data----track-a-new-purchase-for-this-player)

##### postPlayerOnFocus( $data ) - Increment the Players total session length

[](#postplayeronfocus-data----increment-the-players-total-session-length)

### Notifications

[](#notifications)

##### getNotifications( $app\_id, $limit, $offset ) - Get all Notifications for an App

[](#getnotifications-app_id-limit-offset----get-all-notifications-for-an-app)

##### getNotification( $id, $app\_id ) - Get a Notification from an App

[](#getnotification-id--app_id----get-a-notification-from-an-app)

##### postNotification( $data, $app\_id ) - Add a Notification to an App

[](#postnotification-data-app_id----add-a-notification-to-an-app)

```
$response = OneSignal::postNotification([
    "tags"                  =>  [ ["key" => "myKey", "relation" => "=", "value" => 1 ] ],
    "contents"              => ["en" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean et iaculis enim. Sed egestas porttitor laoreet."],
    "headings"              => ["en" => "Aliquam consectetur odio sed"],
]);

```

##### putNotificationTrackOpen( $id, $app\_id, $opened ) - Track whether a Notification was opened

[](#putnotificationtrackopen-id-app_id-opened----track-whether-a-notification-was-opened)

##### deleteNotification( $id, $app\_id ) - Delete a Notification from an App

[](#deletenotification-id-app_id----delete-a-notification-from-an-app)

References
----------

[](#references)

The official OneSignal API documentation is listed here:

Acknowledgements
----------------

[](#acknowledgements)

This project was inspired by, and evolved from,

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance15

Infrequent updates — may be unmaintained

Popularity32

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 85.3% 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 ~160 days

Recently: every ~293 days

Total

9

Last Release

2346d ago

PHP version history (3 changes)1.0.0PHP 7.\*|5.4.\*

1.0.2PHP &gt;=5.4

1.0.4PHP &gt;=5.5

### Community

Maintainers

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

---

Top Contributors

[![jmrieger](https://avatars.githubusercontent.com/u/9476375?v=4)](https://github.com/jmrieger "jmrieger (29 commits)")[![yvolkan](https://avatars.githubusercontent.com/u/12389420?v=4)](https://github.com/yvolkan "yvolkan (2 commits)")[![diegodm2](https://avatars.githubusercontent.com/u/149350428?v=4)](https://github.com/diegodm2 "diegodm2 (1 commits)")[![hloehrmann](https://avatars.githubusercontent.com/u/973710?v=4)](https://github.com/hloehrmann "hloehrmann (1 commits)")[![pefernandez](https://avatars.githubusercontent.com/u/4737073?v=4)](https://github.com/pefernandez "pefernandez (1 commits)")

---

Tags

laravelpushlumenWebPushlaravel 5onesignal

### Embed Badge

![Health badge](/badges/jmrieger-onesignal-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/jmrieger-onesignal-laravel/health.svg)](https://phpackages.com/packages/jmrieger-onesignal-laravel)
```

###  Alternatives

[berkayk/onesignal-laravel

OneSignal Push Wrapper Laravel

5295.9M12](/packages/berkayk-onesignal-laravel)

PHPackages © 2026

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