PHPackages                             marcelopetrucio/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. [API Development](/categories/api)
4. /
5. marcelopetrucio/onesignal-laravel

ActiveLibrary[API Development](/categories/api)

marcelopetrucio/onesignal-laravel
=================================

OneSignal Push Wrapper Laravel

v2.0.0(6y ago)04MITPHPPHP &gt;=5.4.0

Since Apr 29Pushed 6y agoCompare

[ Source](https://github.com/MarceloPetrucio/laravel-onesignal)[ Packagist](https://packagist.org/packages/marcelopetrucio/onesignal-laravel)[ RSS](/packages/marcelopetrucio-onesignal-laravel/feed)WikiDiscussions master Synced yesterday

READMEChangelog (1)Dependencies (4)Versions (15)Used By (0)

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

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

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

[](#introduction)

This is a simple OneSignal wrapper library for Laravel. It simplifies the basic notification flow with the defined methods. You can send a message to all users or you can notify a single user. Before you start installing this service, please complete your OneSignal setup at  and finish all the steps that is necessary to obtain an application id and REST API Keys.

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

[](#installation)

First, you'll need to require the package with Composer:

```
composer require marcelopetrucio/onesignal-laravel
```

Afterwards, run `composer update` from your command line.

**You only need to do the following if your Laravel version is below 5.5**:

Then, update `config/app.php` by adding an entry for the service provider.

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

Then, register class alias by adding an entry in aliases section

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

Finally, from the command line again, run

```
php artisan vendor:publish --tag=config

```

to publish the default configuration file. This will publish a configuration file named `onesignal.php` which includes your apps ID and your OneSignal authorization keys.

> **Note:** If the previous command does not publish the config file successfully, please check the steps involving *providers* and *aliases* in the `config/app.php` file.

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

[](#configuration)

You need to fill in `onesignal.php` file that is found in your applications `config` directory. `app_id` is your *OneSignal App ID* and `rest_api_key` is your *REST API Key*.

Usage
-----

[](#usage)

### Sending a Notification To All Users

[](#sending-a-notification-to-all-users)

You can easily send a message to all registered users with the command

```
    OneSignal::app("appNumberOne")
        ->message("Some Message")
        ->send();
```

### Sending a Notification based on Tags/Filters

[](#sending-a-notification-based-on-tagsfilters)

You can send a message based on a set of tags with the command

##### Example 1:

[](#example-1)

```
    OneSignal::app("appNumberOne")
        ->message("Some Message")
        ->filters(
	    array(
	        ["field" => "email", "relation" => "=", "value" => "email21@example.com"],
	        ["field" => "email", "relation" => "=", "value" => "email1@example.com"],
	    )
        )->send();
```

##### Example 2:

[](#example-2)

```
    OneSignal::app("appNumberOne")
        ->message("Some Message")
        ->filters(
	    array(
	        ["field" => "session_count", "relation" => ">", "value" => '2'],
	        ["field" => "first_session", "relation" => ">", "value" => '2000'],
	    )
        )->send();
```

### Sending a Notification To A Specific User

[](#sending-a-notification-to-a-specific-user)

After storing a user's tokens in a table, you can simply send a message with

```
    OneSignal::app("app_teste")
        ->message("Some Message")
        ->includePlayerIds("ID_USER")
        ->send();
```

`ID_USER` is the user's unique id where he/she is registered for notifications. Read  for additional details.

### Sending a Notification To Segment

[](#sending-a-notification-to-segment)

You can simply send a notification to a specific segment with

```
    OneSignal::app("app_teste")
    	->message("Some Message")
    	->includedSegments("SEGMENT")
    	->send();
```

### Sending a Custom Notification

[](#sending-a-custom-notification)

You can send a custom message with

```
    OneSignal::sendNotificationCustom($parameters);
```

### Sending a Custom Notification

[](#sending-a-custom-notification-1)

### Sending a async Custom Notification

[](#sending-a-async-custom-notification)

You can send a async custom message with

```
    OneSignal::async()->sendNotificationCustom($parameters);
```

Please refer to  for all customizable parameters.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~99 days

Recently: every ~170 days

Total

13

Last Release

2475d ago

Major Versions

0.9.9 → v1.0.02018-09-23

v1.0.1 → v2.0.02019-08-03

### Community

Maintainers

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

---

Top Contributors

[![berkayk](https://avatars.githubusercontent.com/u/603844?v=4)](https://github.com/berkayk "berkayk (45 commits)")[![Maykonn](https://avatars.githubusercontent.com/u/1479805?v=4)](https://github.com/Maykonn "Maykonn (8 commits)")[![MarceloPetrucio](https://avatars.githubusercontent.com/u/24949530?v=4)](https://github.com/MarceloPetrucio "MarceloPetrucio (6 commits)")[![ckin-loox](https://avatars.githubusercontent.com/u/154812537?v=4)](https://github.com/ckin-loox "ckin-loox (4 commits)")[![CarlosHe](https://avatars.githubusercontent.com/u/7402056?v=4)](https://github.com/CarlosHe "CarlosHe (4 commits)")[![Mohammad-Alavi](https://avatars.githubusercontent.com/u/24431504?v=4)](https://github.com/Mohammad-Alavi "Mohammad-Alavi (4 commits)")[![mbardelmeijer](https://avatars.githubusercontent.com/u/1583095?v=4)](https://github.com/mbardelmeijer "mbardelmeijer (3 commits)")[![MatheusNaldi](https://avatars.githubusercontent.com/u/16821957?v=4)](https://github.com/MatheusNaldi "MatheusNaldi (2 commits)")[![Chathula](https://avatars.githubusercontent.com/u/4932296?v=4)](https://github.com/Chathula "Chathula (2 commits)")[![ksvendsen](https://avatars.githubusercontent.com/u/302771?v=4)](https://github.com/ksvendsen "ksvendsen (2 commits)")[![masucip](https://avatars.githubusercontent.com/u/4775729?v=4)](https://github.com/masucip "masucip (1 commits)")[![marcus-campos](https://avatars.githubusercontent.com/u/5151894?v=4)](https://github.com/marcus-campos "marcus-campos (1 commits)")[![kossa](https://avatars.githubusercontent.com/u/1175584?v=4)](https://github.com/kossa "kossa (1 commits)")[![mbabker](https://avatars.githubusercontent.com/u/368545?v=4)](https://github.com/mbabker "mbabker (1 commits)")[![jmrieger](https://avatars.githubusercontent.com/u/9476375?v=4)](https://github.com/jmrieger "jmrieger (1 commits)")[![mfraihi](https://avatars.githubusercontent.com/u/2482519?v=4)](https://github.com/mfraihi "mfraihi (1 commits)")[![mohammad6006](https://avatars.githubusercontent.com/u/553379?v=4)](https://github.com/mohammad6006 "mohammad6006 (1 commits)")[![hafael](https://avatars.githubusercontent.com/u/571130?v=4)](https://github.com/hafael "hafael (1 commits)")[![narazin](https://avatars.githubusercontent.com/u/5402603?v=4)](https://github.com/narazin "narazin (1 commits)")[![ryanedgar](https://avatars.githubusercontent.com/u/7726735?v=4)](https://github.com/ryanedgar "ryanedgar (1 commits)")

---

Tags

laravelpushWebPushlaravel 5onesignal

### Embed Badge

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

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

###  Alternatives

[berkayk/onesignal-laravel

OneSignal Push Wrapper Laravel

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

OneSignal Push Wrapper For Illuminate

2518.3k](/packages/jmrieger-onesignal-laravel)

PHPackages © 2026

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