PHPackages                             rich2k/pusher-beams - 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. rich2k/pusher-beams

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

rich2k/pusher-beams
===================

Pusher Beams is a push notification service from Pusher.

v1.0.19(10mo ago)012.7k↓43.8%4MITPHPPHP &gt;=8.0

Since Feb 6Pushed 10mo ago2 watchersCompare

[ Source](https://github.com/Rich2k/pusher-beams)[ Packagist](https://packagist.org/packages/rich2k/pusher-beams)[ Docs](https://github.com/Rich2k/pusher-beams)[ RSS](/packages/rich2k-pusher-beams/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (7)Versions (18)Used By (0)

Pusher Beams - push notifications for Laravel
=============================================

[](#pusher-beams---push-notifications-for-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/98e4c826e0581d32f7b902efd483c260d64b75d85d0f8da885680816a7c4508e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f72696368326b2f7075736865722d6265616d732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/rich2k/pusher-beams)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Quality Score](https://camo.githubusercontent.com/88be71c0ce1d48d2a0cad8b68202f54559e6c31eefae09a83ebf986f2f0e6fdf/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6e656f6967686f6461726f2f7075736865722d6265616d732e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/rich2k/pusher-beams)

This package makes it easy to send [Pusher push notifications](https://docs.pusher.com/push-notifications) with Laravel (should work with other non-laravel PHP projects). It's based off [this package](https://github.com/laravel-notification-channels/pusher-push-notifications) by Mohamed Said.

This fork exists to allow us to run both the Pusher Beams and old Pusher Channels code side by side.

Contents
--------

[](#contents)

- [Installation](#installation)
    - [Setting up your Pusher account](#setting-up-your-pusher-account)
    - [Configuration](#configuration)
- [Usage](#usage)
    - [Available Message methods](#available-message-methods)
- [Testing](#testing)
- [Security](#security)
- [Contributing](#contributing)
- [Credits](#credits)
- [License](#license)

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

[](#installation)

You can install the package via composer:

```
composer require rich2k/pusher-beams
```

You must install the service provider:

```
// config/app.php
'providers' => [
    ...
    Rich2k\PusherBeams\PusherBeamsServiceProvider::class,
],
```

### Setting up your Pusher account

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

Before using this package you should set up a Pusher account. Here are the steps required.

- Login to
- Select *Beams* from the side bar, and click *Create* from the right to create your Instance.
- Go to the settings tab (you can close the wizard)
- Upload your iOS .p8 auth key (they guides you through this), your iOS Team Id and/or your CM server key.
- Now select the *Credentials* tab.
- Copy your instanceId and SecretKey.
- Update the values in your `config/broadcasting.php` file under the pusher connection, see below.
- You're now good to go.

### Configuration

[](#configuration)

In `config/broadcasting.php`

```
'connections' => [
    ...
    'pusher' => [
        'beams' => [
            'secret_key' => env('PUSHER_BEAMS_SECRET'),
            'instance_id' => env('PUSHER_BEAMS_INSTANCE_ID'),
        ],
    ],

],
```

Usage
-----

[](#usage)

Now you can use the channel in your `via()` method inside the `Notification` class.

```
use Rich2k\PusherBeams\PusherBeams;
use Rich2k\PusherBeams\PusherBeamsMessage;
use Illuminate\Notifications\Notification;

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

    public function toPusherBeamsNotification($notifiable)
    {
        return PusherBeamsMessage::create()
            ->iOS()
            ->badge(1)
            ->sound('success')
            ->body("Your {$notifiable->service} account was approved!");
    }
}
```

### Available Message methods

[](#available-message-methods)

- `platform('')`: Accepts a string value of `iOS` or `Android`.
- `iOS()`: Sets the platform value to iOS.
- `android()`: Sets the platform value to Android.
- `title('')`: Accepts a string value for the title.
- `body('')`: Accepts a string value for the body.
- `sound('')`: Accepts a string value for the notification sound file. Notice that if you leave blank the default sound value will be `default`.
- `icon('')`: Accepts a string value for the icon file. (Android Only)
- `badge(1)`: Accepts an integer value for the badge. (iOS Only)
- `setOption($key, $value)`: Allows you to set any value in the message payload. For more information [check here for iOS](https://docs.pusher.com/beams/getting-started/ios/publish-notifications#custom-data), [or here for Android](https://docs.pusher.com/beams/getting-started/android/publish-notifications#custom-data).
- `withiOS(PusherBeamsMessage $message)`: Set an extra message to be sent to iOS
- `withAndroid(PusherBeamsMessage $message)`: Set an extra message to be sent to Android

### Sending to multiple platforms

[](#sending-to-multiple-platforms)

You can send a single message to an iOS device and an Android device at the same time using the `withiOS()` and `withAndroid()` method:

```
use Rich2k\PusherBeams\PusherBeams;
use Rich2k\PusherBeams\PusherBeamsMessage;
use Illuminate\Notifications\Notification;

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

    public function toPusherBeamsNotification($notifiable)
    {
        return PusherBeamsMessage::create()
            ->android()
            ->sound('success')
            ->body("Your {$notifiable->service} account was approved!")
            ->withiOS(PusherBeamsMessage::create()
                ->body("Your {$notifiable->service} account was approved!")
                ->badge(1)
                ->sound('success')
            );
    }
}
```

### Routing a message

[](#routing-a-message)

By default the Pusher beams "interest" messages will be sent to will be defined using the {notifiable}.{id} convention, for example `App.User.1`, however you can change this behaviour by including a `routeNotificationForPusherPushNotifications()` in the notifiable class method that returns the interest name.

Whatever interest you set in the app is the interest you should register for within your mobil

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)

- [Richard Hyland](https://github.com/Rich2k)
- [Neo Ighodaro](https://github.com/neoighodaro)
- Mohamed Said
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance54

Moderate activity, may be stable

Popularity27

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity74

Established project with proven stability

 Bus Factor1

Top contributor holds 52.9% 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 ~155 days

Recently: every ~225 days

Total

16

Last Release

322d ago

PHP version history (3 changes)v1.0.4PHP &gt;=7.0

v1.0.5PHP &gt;=7.1

v1.0.19PHP &gt;=8.0

### Community

Maintainers

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

---

Top Contributors

[![Rich2k](https://avatars.githubusercontent.com/u/194617?v=4)](https://github.com/Rich2k "Rich2k (27 commits)")[![neoighodaro](https://avatars.githubusercontent.com/u/807318?v=4)](https://github.com/neoighodaro "neoighodaro (22 commits)")[![bsormagec](https://avatars.githubusercontent.com/u/965219?v=4)](https://github.com/bsormagec "bsormagec (1 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (1 commits)")

---

Tags

laravelpushnotificationpusherpush notificationsbeams

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/rich2k-pusher-beams/health.svg)

```
[![Health](https://phpackages.com/badges/rich2k-pusher-beams/health.svg)](https://phpackages.com/packages/rich2k-pusher-beams)
```

###  Alternatives

[laravel-notification-channels/twilio

Provides Twilio notification channel for Laravel

2587.7M12](/packages/laravel-notification-channels-twilio)[neo/pusher-beams

Pusher Beams is a push notification service from Pusher.

133.1k](/packages/neo-pusher-beams)[laravel-notification-channels/pusher-push-notifications

Pusher native Push Notifications driver.

282733.2k1](/packages/laravel-notification-channels-pusher-push-notifications)[laravel-notification-channels/telegram

Telegram Notifications Channel for Laravel

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

Laravel notification driver for Discord.

2371.3M11](/packages/laravel-notification-channels-discord)[edujugon/push-notification

Laravel Package to send push notifications to Android and IOS devices. (GCM,FCM,APN)

4891.4M1](/packages/edujugon-push-notification)

PHPackages © 2026

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