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

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

khidirdotid/laravel-onesignal
=============================

A OneSignal Wrapper for Laravel

v1.0.5(3d ago)045MITPHPPHP ^8.1

Since May 1Pushed 3d agoCompare

[ Source](https://github.com/KhidirDotID/laravel-onesignal)[ Packagist](https://packagist.org/packages/khidirdotid/laravel-onesignal)[ Fund](https://www.buymeacoffee.com/ladumor)[ RSS](/packages/khidirdotid-laravel-onesignal/feed)WikiDiscussions main Synced today

READMEChangelog (5)Dependencies (12)Versions (8)Used By (0)

Laravel One Signal
==================

[](#laravel-one-signal)

Laravel One Signal is Laravel Wrapper for [One Signal](https://onesignal.com). One Signal is a great platform for send a push notification to your users. This package mentions in One Signal's official Document. you can see [here](https://documentation.onesignal.com/docs/other-cms-setup)

[![Total Downloads](https://camo.githubusercontent.com/31a8595ece63b7b3b200b02d7d3050239fdeaa9b9f1187fcd9239cc110f59dc9/68747470733a2f2f706f7365722e707567782e6f72672f6c6164756d6f722f6f6e652d7369676e616c2f646f776e6c6f616473)](https://packagist.org/packages/ladumor/one-signal)[![Daily Downloads](https://camo.githubusercontent.com/e22114e38121207e3db2591de15735b4ab7d8fb68e2be26c52231d8374c04b77/68747470733a2f2f706f7365722e707567782e6f72672f6c6164756d6f722f6f6e652d7369676e616c2f642f6461696c79)](https://packagist.org/packages/ladumor/one-signal)[![Monthly Downloads](https://camo.githubusercontent.com/4eec45914de2d02bb5c1c795c519006432b5c8e9c143dab1ebc5dcb408f5faae/68747470733a2f2f706f7365722e707567782e6f72672f6c6164756d6f722f6f6e652d7369676e616c2f642f6d6f6e74686c79)](https://packagist.org/packages/ladumor/one-signal)[![License](https://camo.githubusercontent.com/2b5e7fb72008b9ce513674e45a14af3446386e56053325e767b9b89a0fbae404/68747470733a2f2f706f7365722e707567782e6f72672f6c6164756d6f722f6f6e652d7369676e616c2f6c6963656e7365)](LICENSE.md)

Give a Star if this package realy usefull to you. it's free 😆
=============================================================

[](#give-a-star-if-this-package-realy-usefull-to-you-its-free-laughing)

🎞️ here are video tutorials
---------------------------

[](#film_strip-here-are-video-tutorials)

#### How to install and how to implement notifications and devices APIs.

[](#how-to-install-and-how-to-implement-notifications-and-devices-apis)

[![](https://camo.githubusercontent.com/dd3e1b7989bbb2de3c4c960bbedf542a30dc04b16ce09ed816adad873b724d0b/68747470733a2f2f696d672e796f75747562652e636f6d2f76692f63315737756e4f773373342f302e6a7067)](https://youtu.be/c1W7unOw3s4)

#### how to implement Segment and Apps APIs.

[](#how-to-implement-segment-and-apps-apis)

[![](https://camo.githubusercontent.com/1c479deb475442d60aead360c024bf52e049394d4c58f922df7f50591388788f/68747470733a2f2f696d672e796f75747562652e636f6d2f76692f6d7869455a3448326367592f302e6a7067)](https://youtu.be/mxiEZ4H2cgY)

Contents
--------

[](#contents)

- [Installation](#installation)
    - [Publish the config file](#publish-the-config-file)
    - [Add Provider](#add-provider)
    - [Add Facade](#add-facade)
- [Usage](#usage)
    - [Send Push Notification](#send-push-notification)
    - [Cancel Notification](#cancel-notification)
    - [Customise Contents](#customise-contents)
    - [Get All Notifications](#get-all-notifications)
    - [Get Single Notification](#get-single-notification)
    - [Get All Devices](#get-all-devices)
    - [Get Single Device](#get-single-device)
    - [Create Device](#get-single-device)
    - [Update Device](#update-device)
    - [Delete Device](#delete-device)
    - [Create Segment (NEED PAID PLAN)](#create-segment)
    - [Delete Segment (NEED PAID PLAN)](#delete-segment)
    - [View Apps](#view-apps)
    - [View App](#view-app)
    - [Create App](#create-app)
    - [Update App](#update-app)
    - [View Outcomes](#view-outcomes)
- [User Device](#user-device)
- [Change Log](#change-log)
- [License](#license)

Watch Other Lavavel tutorial here
---------------------------------

[](#watch-other-lavavel-tutorial-here)

[![](https://camo.githubusercontent.com/78b94b1a27e59e40a309e49b70ed1d231ba18bdf25f4f93b7d57173cac6039b7/68747470733a2f2f696d672e796f75747562652e636f6d2f76692f794d7473674273714451732f302e6a7067)](https://www.youtube.com/channel/UCuCjzuwBqMqFdh0EU-UwQ-w?sub_confirmation=1))

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

[](#installation)

Install the package by the following command,

```
composer require ladumor/one-signal:0.4.4

```

Publish the config file
-----------------------

[](#publish-the-config-file)

Run the following command to publish config file,

```
php artisan vendor:publish --provider="Ladumor\OneSignal\OneSignalServiceProvider"

```

Add Provider
------------

[](#add-provider)

Add the provider to your `config/app.php` into `provider` section if using lower version of laravel,

```
Ladumor\OneSignal\OneSignalServiceProvider::class,

```

Add Facade
----------

[](#add-facade)

Add the Facade to your `config/app.php` into `aliases` section,

```
'OneSignal' => \Ladumor\OneSignal\OneSignal::class,

```

Add ENV data
------------

[](#add-env-data)

Add your api keys and OneSignal app id to your `.env`,

```
ONE_SIGNAL_APP_ID=XXXXXX-XXXXXX-XXXXXX-XXXXXX  (YOUR APP ID)
ONE_SIGNAL_AUTHORIZE=XXXXXX                    (REST API KEY)
ONE_SIGNAL_AUTH_KEY=XXXXXXX                    (YOUR USER AUTH KEY)

```

You can call them into your code with,

Usage
-----

[](#usage)

### Send Push Notification

[](#send-push-notification)

For send push notification, use the sendPush method by calling,

```
$fields['include_player_ids'] = ['xxxxxxxx-xxxx-xxx-xxxx-yyyyyyyyy'];
$message = 'hey!! this is test push.!'

OneSignal::sendPush($fields, $message);

```

Optionally, you can obtain the id of the notification like this,

```
$notificationID = OneSignal::sendPush($fields, $message);
echo $notificationID["id"];

```

### Cancel Notification

[](#cancel-notification)

To cancel a notification, use the cancelNotification method by calling,

```
$notificationID = 'xxxxxxxx-xxxx-xxx-xxxx-yyyyyyyyy';

OneSignal::cancelNotification($notificationID);

```

### Customise Contents

[](#customise-contents)

You can customise a contents and pass it in fields. message does not required when you pass contents

```
$fields['include_player_ids'] = ['xxxxxxxx-xxxx-xxx-xxxx-yyyyyyyyy'];
$fields['contents'] = array(
                          "en" => 'English Message',
                          "es" => 'Spanish Message',
                      );
OneSignal::sendPush($fields);

```

### Get All Notifications

[](#get-all-notifications)

For retrieve all notifications, use the `getNotifications` method by calling,

```
OneSignal::getNotifications();

```

You can check [here](https://documentation.onesignal.com/reference#section-result-format-view-notifications) return response format.

### Get Single Notification

[](#get-single-notification)

For retrieve single notification, use the `getNotification` method with id param by calling,

```
OneSignal::getNotification($notificationId);

```

You can check [here](https://documentation.onesignal.com/reference#section-result-format-view-notification) return response format.

### Get All Devices

[](#get-all-devices)

For retrieve all user devices, use the `getDevices` method by calling,

```
OneSignal::getDevices();

```

You can check [here](https://documentation.onesignal.com/reference#view-devices) return response format.

### Get Single Device

[](#get-single-device)

For retrieve single Devices, use the `getDevice` method with id param by calling,

```
OneSignal::getDevice($deviceId);

```

You can check [here](https://documentation.onesignal.com/reference#view-device) return response format.

### Create Device

[](#create-device)

For add a device in your application, use the `addDevice` method by calling, if you want to create device in different application than you can specify `app_id` in `$fields` array.

```
 $fields = [
        'device_type'  => 0,
        'identifier'   => '7abcd558f29d0b1f048083e2834ad8ea4b3d87d8ad9c088b33c132706ff445f0',
        'timezone'     => '-28800',
        'game_version' => '1.1',
        'device_os'    => '7.0.4',
        'test_type'    => 1,
        'device_model' => "iPhone 8,2",
        'tags'         => array("foo" => "bar")
    ];

 return OneSignal::addDevice($fields);

```

You can check [here](https://documentation.onesignal.com/reference#section-example-code-add-a-device) supported parameters and guide.

### Update Device

[](#update-device)

For update a device in your application, use the `addDevice` method by calling, if you want to update device in different application than you can specify `app_id` in `$fields` array.

```
 $fields = [
        'device_type'  => 0,
        'identifier'   => '7abcd558f29d0b1f048083e2834ad8ea4b3d87d8ad9c088b33c132706ff445f0',
        'timezone'     => '-28800',
        'game_version' => '1.1',
        'device_os'    => '7.0.4',
        'test_type'    => 1,
        'device_model' => "iPhone 8,2",
        'tags'         => array("foo" => "bar")
    ];

 $playerId = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';

 return OneSignal::updateDevice($fields, $playerId);

```

You can check [here](https://documentation.onesignal.com/reference#section-body-parameters) supported parameters and guide.

### Delete Device

[](#delete-device)

Delete existing device on your application

```
OneSignal::deleteDevice($deviceId);

```

### Create Segment

[](#create-segment)

#### NOTE: REQUIRED ONE-SIGNAL [PAID PLAN](https://documentation.onesignal.com/docs/paid-plan-benefits)

[](#note-required-one-signal-paid-plan)

For add a new segment in your application, use the `createSegment` method by calling,

```
 $fields = [
         'name' => 'iOS, Android, Web',
         "filters" => array("field" => "device_type", "relation" => "=", "value" => "Android"),
     ];

return OneSignal::createSegment($fields);

```

You can check [here](https://documentation.onesignal.com/reference#create-segments) supported parameters and guide.

```
OneSignal::deleteSegment('YOUR_SEGMENT_ID')

```

### Delete Segment

[](#delete-segment)

#### NOTE: REQUIRED ONE-SIGNAL [PAID PLAN](https://documentation.onesignal.com/docs/paid-plan-benefits)

[](#note-required-one-signal-paid-plan-1)

You can check [here](https://documentation.onesignal.com/reference#delete-segments) for more guide.

Apps
----

[](#apps)

Note\*: `Auth key must be set in one-signal.php` how to get [auth\_key](https://documentation.onesignal.com/docs/accounts-and-keys#section-user-auth-key)?

### View Apps

[](#view-apps)

View the details of all of your current OneSignal apps

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

```

You can check [here](https://documentation.onesignal.com/reference#view-apps-apps) api response.

### View App

[](#view-app)

View the details of single of your current OneSignal app or other app by passing app id.

```
 // It's return default site which is configured in config.
 $app = OneSignal::getApp();

 // you can specify app id as wel but it's optional
 $app = OneSignal::getApp('YOUR_APP_ID');

```

You can check [here](https://documentation.onesignal.com/reference#view-an-app) api response.

### Create App

[](#create-app)

Creates a new OneSignal app.

```
 $fields = array(
        'name' => "TestByMe"
    );

 OneSignal::createApp($fields);

```

You can check [here](https://documentation.onesignal.com/reference#create-an-app) supported parameters and guide.

### Update App

[](#update-app)

Update a new OneSignal app.

```
 $fields = array(
        'name' => "TestByMe"
    );

 OneSignal::updateApp($fields);
 // you can pass second param as a appId if you want to update other app.. default take from config.

```

You can check [here](https://documentation.onesignal.com/reference#update-an-app) supported parameters and guide.

### View Outcomes

[](#view-outcomes)

Update a new OneSignal app.

```
 $fields = array(
        'outcome_names'       => "os__click.count",
        'outcome_time_range'  => '1h',
        'outcome_platform'    => 0,
        'outcome_attribution' => 'direct'
    );

 OneSignal::getOutcomes($fields);   // with params
 OneSignal::getOutcomes();  // without any params
 // you can pass params in this method, it's optional.

```

You can check [here](https://documentation.onesignal.com/reference/view-outcomes) supported parameters and guide.

User Device
-----------

[](#user-device)

[![](https://camo.githubusercontent.com/59feebd3d40fcbb1104a3f554ec3b754f1b37674254fde3b0d8f069c1b1d958b/68747470733a2f2f696d672e796f75747562652e636f6d2f76692f774f483171735133534c382f302e6a7067)](https://youtu.be/wOH1qsQ3SL8)

You can generate a User Device APIs with just one command,

```
php artisan one-signal.userDevice:publish

```

this command generate following files,

- UserDeviceAPIController
- UserDeviceAPIRepository
- UserDevice (model)
- Migration

Also, do not forget to add following routes in to the `api.php` file.

```
use App\Http\Controllers\API\UserDeviceAPIController;

```

```
  Route::post('user-device/register', [UserDeviceAPIController::class, 'registerDevice']);
  Route::get('user-device/{playerId}/update-status', [UserDeviceAPIController::class, 'updateNotificationStatus']);

```

### Change Log

[](#change-log)

Please see [Change Log](CHANGELOG.md) here

### License

[](#license)

The MIT License (MIT). Please see [License](LICENSE.md) File for more information

###  Health Score

47

—

FairBetter than 93% of packages

Maintenance99

Actively maintained with recent releases

Popularity10

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 82% 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 ~231 days

Recently: every ~210 days

Total

6

Last Release

3d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/20750742?v=4)[Khidir Zahid](/maintainers/KhidirDotID)[@KhidirDotID](https://github.com/KhidirDotID)

---

Top Contributors

[![shailesh-ladumor](https://avatars.githubusercontent.com/u/16555999?v=4)](https://github.com/shailesh-ladumor "shailesh-ladumor (73 commits)")[![KhidirDotID](https://avatars.githubusercontent.com/u/20750742?v=4)](https://github.com/KhidirDotID "KhidirDotID (9 commits)")[![ItsSkynet](https://avatars.githubusercontent.com/u/3202479?v=4)](https://github.com/ItsSkynet "ItsSkynet (6 commits)")[![fajarsulaksono](https://avatars.githubusercontent.com/u/202346?v=4)](https://github.com/fajarsulaksono "fajarsulaksono (1 commits)")

---

Tags

laravelpushnotificationonesignal

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[laravel/sail

Docker files for running a basic Laravel application.

1.9k205.7M1.3k](/packages/laravel-sail)[propaganistas/laravel-disposable-email

Disposable email validator

6023.0M6](/packages/propaganistas-laravel-disposable-email)[laravel/ai

The official AI SDK for Laravel.

1.0k3.2M194](/packages/laravel-ai)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

77022.3M151](/packages/laravel-mcp)[tallstackui/tallstackui

TallStackUI is a powerful suite of Blade components that elevate your workflow of Livewire applications.

725172.4k14](/packages/tallstackui-tallstackui)[laravel-notification-channels/discord

Laravel notification driver for Discord.

2401.4M17](/packages/laravel-notification-channels-discord)

PHPackages © 2026

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