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

ActiveLibrary

elnooronline/onesignal
======================

OneSignal Notifications driver

1.1.0(8y ago)13171MITPHPPHP &gt;=5.6.4

Since Aug 11Pushed 8y ago3 watchersCompare

[ Source](https://github.com/Elnooronline/onesignal)[ Packagist](https://packagist.org/packages/elnooronline/onesignal)[ Docs](https://github.com/laravel-notification-channels/onesignal)[ RSS](/packages/elnooronline-onesignal/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (6)Versions (7)Used By (0)

OneSignal notifications channel for Laravel 5.3
===============================================

[](#onesignal-notifications-channel-for-laravel-53)

[![Latest Version on Packagist](https://camo.githubusercontent.com/175bffa259a74dd28b91370d9256456d7df8aa0ec3822961bceda6048c6455f4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c61726176656c2d6e6f74696669636174696f6e2d6368616e6e656c732f6f6e657369676e616c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/laravel-notification-channels/onesignal)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/22c37a27e3a5eb4599472ecfb8c8c8fca497e77f7e4f19b318801676b1e4c01e/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6c61726176656c2d6e6f74696669636174696f6e2d6368616e6e656c732f6f6e657369676e616c2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/laravel-notification-channels/onesignal)[![StyleCI](https://camo.githubusercontent.com/5aa508ba52e7eef928bd37347e405de61819fed2055ea4391529980b2f2f0211/68747470733a2f2f7374796c6563692e696f2f7265706f732f36353337393332312f736869656c64)](https://styleci.io/repos/65379321)[![SensioLabsInsight](https://camo.githubusercontent.com/cc88870747ad11c0f3b0a6d4efcde14e8d74df772b765e80d8a624cd11836395/68747470733a2f2f696d672e736869656c64732e696f2f73656e73696f6c6162732f692f39303135363931662d313330642d346663612d383731302d3732613031306162633638342e7376673f7374796c653d666c61742d737175617265)](https://insight.sensiolabs.com/projects/9015691f-130d-4fca-8710-72a010abc684)[![Quality Score](https://camo.githubusercontent.com/45431d1c3b806dba3e8605a1538e81536200cd512d984f06090c5030b501cd20/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6c61726176656c2d6e6f74696669636174696f6e2d6368616e6e656c732f6f6e657369676e616c2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/laravel-notification-channels/onesignal)[![Code Coverage](https://camo.githubusercontent.com/267277fb3c5469eff6dc9fa894adab12b1d2fc383af9dce1999f73ad95ba0a93/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f6c61726176656c2d6e6f74696669636174696f6e2d6368616e6e656c732f6f6e657369676e616c2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/laravel-notification-channels/onesignal/?branch=master)[![Total Downloads](https://camo.githubusercontent.com/486d9942ee06a1d46b3bc42a262c9563a97fc106d7316e63a56173fe46ce48a1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c61726176656c2d6e6f74696669636174696f6e2d6368616e6e656c732f6f6e657369676e616c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/laravel-notification-channels/onesignal)

This package makes it easy to send [OneSignal notifications](https://documentation.onesignal.com/docs) with Laravel 5.3.

Contents
--------

[](#contents)

- [Installation](#installation)
    - [Setting up your OneSignal account](#setting-up-your-onesignal-account)
- [Usage](#usage)
    - [Available Message methods](#available-message-methods)
    - [Button usage](#button-usage)
    - [WebButton usage](#webbutton-usage)
- [Changelog](#changelog)
- [Testing](#testing)
- [Security](#security)
- [Contributing](#contributing)
- [Credits](#credits)
- [License](#license)

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

[](#installation)

You can install the package via composer:

```
composer require laravel-notification-channels/onesignal
```

You must install the service provider:

```
// config/app.php
'providers' => [
    ...
    NotificationChannels\OneSignal\OneSignalServiceProvider::class,
],
```

### Setting up your OneSignal account

[](#setting-up-your-onesignal-account)

Add your OneSignal App ID and REST API Key to your `config/services.php`:

```
// config/services.php
...
'onesignal' => [
    'app_id' => env('ONESIGNAL_APP_ID'),
    'rest_api_key' => env('ONESIGNAL_REST_API_KEY')
],
...
```

Usage
-----

[](#usage)

Now you can use the channel in your `via()` method inside the notification:

```
use NotificationChannels\OneSignal\OneSignalChannel;
use NotificationChannels\OneSignal\OneSignalMessage;
use NotificationChannels\OneSignal\OneSignalWebButton;
use Illuminate\Notifications\Notification;

class AccountApproved extends Notification
{
    public function via($notifiable)
    {
        return [OneSignalChannel::class];
    }

    public function toOneSignal($notifiable)
    {
        return OneSignalMessage::create()
            ->subject("Your {$notifiable->service} account was approved!")
            ->body("Click here to see details.")
            ->url('http://onesignal.com')
            ->webButton(
                OneSignalWebButton::create('link-1')
                    ->text('Click here')
                    ->icon('https://upload.wikimedia.org/wikipedia/commons/4/4f/Laravel_logo.png')
                    ->url('http://laravel.com')
            );
    }
}
```

In order to let your Notification know which OneSignal user(s) you are targeting, add the `routeNotificationForOneSignal` method to your Notifiable model.

You can either return a single player-id, or if you want to notify multiple player IDs just return an array containing all IDs.

```
public function routeNotificationForOneSignal()
{
    return 'ONE_SIGNAL_PLAYER_ID';
}
```

### All available methods

[](#all-available-methods)

- `subject('')`: Accepts a string value for the title.
- `body('')`: Accepts a string value for the notification body.
- `icon('')`: Accepts an url for the icon.
- `url('')`: Accepts an url for the notification click event.
- `webButton(OneSignalWebButton $button)`: Allows you to add action buttons to the notification (Chrome 48+ (web push) only).
- `button(OneSignalButton $button)`: Allows you to add buttons to the notification (Supported by iOS 8.0 and Android 4.1+ devices. Icon only works for Android).
- `setData($key, $value)`: Allows you to set additional data for the message payload. For more information check the [OneSignal documentation](https://documentation.onesignal.com/reference).

### Button usage

[](#button-usage)

```
OneSignalMessage::create()
    ->button(
        OneSignalButton::create('id')
            ->text('button text')
            ->icon('button icon')
    );
```

### WebButton usage

[](#webbutton-usage)

```
OneSignalMessage::create()
    ->webButton(
        OneSignalWebButton::create('id')
            ->text('button text')
            ->icon('button icon')
            ->url('button url')
    );
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Credits
-------

[](#credits)

- [Marcel Pociot](https://github.com/mpociot)
- [Freek Van der Herten](https://github.com/freekmurze)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 51% 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 ~223 days

Total

3

Last Release

3099d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0602d9e7baf6a25ba9c191c8bd0c34aed3537de7b3e3076e1ec87f91ddd58dfb?d=identicon)[AlShahawi](/maintainers/AlShahawi)

---

Top Contributors

[![mpociot](https://avatars.githubusercontent.com/u/804684?v=4)](https://github.com/mpociot "mpociot (25 commits)")[![freekmurze](https://avatars.githubusercontent.com/u/483853?v=4)](https://github.com/freekmurze "freekmurze (12 commits)")[![themsaid](https://avatars.githubusercontent.com/u/4332182?v=4)](https://github.com/themsaid "themsaid (4 commits)")[![AlShahawi](https://avatars.githubusercontent.com/u/5667648?v=4)](https://github.com/AlShahawi "AlShahawi (3 commits)")[![casperboone](https://avatars.githubusercontent.com/u/15815208?v=4)](https://github.com/casperboone "casperboone (1 commits)")[![JayBizzle](https://avatars.githubusercontent.com/u/340752?v=4)](https://github.com/JayBizzle "JayBizzle (1 commits)")[![ahmed-aliraqi](https://avatars.githubusercontent.com/u/23261109?v=4)](https://github.com/ahmed-aliraqi "ahmed-aliraqi (1 commits)")[![oyed](https://avatars.githubusercontent.com/u/172114265?v=4)](https://github.com/oyed "oyed (1 commits)")[![abhimanyu003](https://avatars.githubusercontent.com/u/265913?v=4)](https://github.com/abhimanyu003 "abhimanyu003 (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[spatie/laravel-health

Monitor the health of a Laravel application

85810.0M83](/packages/spatie-laravel-health)[laravel-notification-channels/telegram

Telegram Notifications Channel for Laravel

1.1k3.4M35](/packages/laravel-notification-channels-telegram)[laravel-notification-channels/webpush

Web Push Notifications driver for Laravel.

7984.5M16](/packages/laravel-notification-channels-webpush)[s-ichikawa/laravel-sendgrid-driver

This library adds a 'sendgrid' mail driver to Laravel.

4139.3M1](/packages/s-ichikawa-laravel-sendgrid-driver)[yadahan/laravel-authentication-log

Laravel Authentication Log provides authentication logger and notification for Laravel.

416632.8k5](/packages/yadahan-laravel-authentication-log)[laravel-notification-channels/apn

Apple APN Push Notification Channel

2021.9M4](/packages/laravel-notification-channels-apn)

PHPackages © 2026

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