PHPackages                             rohitshakya/laravel-beacon - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. rohitshakya/laravel-beacon

ActiveLibrary[HTTP &amp; Networking](/categories/http)

rohitshakya/laravel-beacon
==========================

Realtime notification UI for Laravel with topbar dropdown, inbox, and Livewire + Echo support. Fully customizable and production ready.

2.2.0(2mo ago)4110MITPHPPHP ^8.2

Since Feb 15Pushed 2mo agoCompare

[ Source](https://github.com/rohitshakyaa/laravel-beacon)[ Packagist](https://packagist.org/packages/rohitshakya/laravel-beacon)[ RSS](/packages/rohitshakya-laravel-beacon/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (20)Versions (9)Used By (0)

🔔 Beacon
========

[](#-beacon)

### Realtime Notification UI for Laravel

[](#realtime-notification-ui-for-laravel)

> Like a lighthouse in the dark, **Beacon** signals new activity to your users.

Beacon is a drop-in notification UI for Laravel that provides a **topbar dropdown**, **inbox page**, and **realtime updates** using Livewire and broadcasting. It is designed to be elegant, customizable, and easy to integrate into any Laravel app — and it works for **any notifiable model**, not just `App\Models\User`.

---

Why "Beacon"?
-------------

[](#why-beacon)

A **beacon** is a guiding signal — a lighthouse that alerts ships of activity and direction.

This package acts the same way:

- Signals new notifications
- Guides users to important updates
- Works in realtime
- Always visible from the topbar

Instead of silently storing notifications in the database, Beacon **announces them** to users through UI, events, and realtime broadcasting.

---

Features
--------

[](#features)

- Topbar notification dropdown
- Full inbox page
- Realtime updates (Echo / Reverb / Pusher)
- Livewire powered UI
- **Multi-notifiable** — works with `User`, `Reseller`, `Employee`, or any model that uses Laravel's `Notifiable` trait
- Multiple topbars on the same page (each bound to its own private channel)
- Fully customizable Blade views
- Browser events for JS integrations
- Plug-and-play config

---

📦 Installation
--------------

[](#-installation)

```
composer require rohitshakya/laravel-beacon
```

Publish config:

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

Publish views (optional):

```
php artisan vendor:publish --tag=beacon-views
```

---

Quick Usage
-----------

[](#quick-usage)

### 1. Add the topbar

[](#1-add-the-topbar)

The simplest case — render for the currently authenticated user:

```

```

Or mount the Livewire component directly:

```

```

Both fall back to `auth()->user()` when no notifiable is passed.

#### Render for any notifiable

[](#render-for-any-notifiable)

Pass any model that uses the `Notifiable` trait:

```
{{-- For a Reseller --}}

{{-- For an Employee --}}

```

Or via the Livewire tag with explicit class + id:

```

```

The same applies to the inbox:

```

{{-- or --}}

```

> **Security note:** the `notifiableClass` and `notifiableId` props on the Livewire components are marked `#[Locked]`, so the client cannot mutate them after mount. The backend must decide which notifiable a given page may view.

#### Multiple topbars on one page

[](#multiple-topbars-on-one-page)

You can render multiple topbars side by side — for example, an admin dashboard showing a personal bell and a reseller-impersonation bell. Each one binds its own private Echo channel, so they update independently:

```
                              {{-- current user --}}
      {{-- reseller, separate channel --}}
```

---

### 2. Send a notification

[](#2-send-a-notification)

```
$user->notify(new SomeNotification());
$reseller->notify(new SomeNotification());
$employee->notify(new SomeNotification());
```

Beacon will automatically appear in UI for whoever the topbar is mounted for.

---

### 3. Listen in JS (optional)

[](#3-listen-in-js-optional)

```
window.addEventListener('beacon:notification', (e) => {
    console.log('New notification', e.detail);
});
```

---

Realtime Setup
--------------

[](#realtime-setup)

Beacon supports:

- Laravel Reverb
- Pusher
- Soketi
- Ably
- Any Echo driver

Make sure Echo is running. You do **not** need to call `Echo.private(...)`yourself — the topbar view binds the resolved channel for you.

The channel name is **derived from the notifiable's class FQCN** by default:

NotifiableChannel`App\Models\User` with id `1``App.Models.User.1``App\Models\Reseller` with id `5``App.Models.Reseller.5``App\Models\Employee` with id `9``App.Models.Employee.9`This matches Laravel's built-in `Notifiable::receivesBroadcastNotificationsOn()`convention, so no custom routing is needed on the broadcaster.

---

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

[](#configuration)

`config/beacon.php`

```
return [

    'views' => [
        'inbox' => 'beacon::inbox.default',
        'item'  => 'beacon::item.default',
    ],

    'topbar' => [
        'limit' => 8,
    ],

    'realtime' => [
        'enabled'         => true,
        'resolver'        => \RohitShakya\Beacon\Support\DefaultChannelResolver::class,
        'channel_pattern' => '{class}.{id}',
        'channels'        => [
            // \App\Models\User::class => 'App.Models.User.{id}',
        ],
        'browser_event'   => 'beacon:notification',
    ],

    'notifications' => [
        // \App\Notifications\InvoicePaid::class => [...],
    ],
];
```

---

Config Options Explained
------------------------

[](#config-options-explained)

### Views

[](#views)

Override the inbox and per-item Blade templates.

```
'views' => [
    'inbox' => 'beacon::inbox.default',
    'item'  => 'beacon::item.default',
],
```

The topbar view is the Livewire view (`beacon::livewire.topbar`) — publish it with `php artisan vendor:publish --tag=beacon-views` and edit `resources/views/vendor/beacon/livewire/topbar.blade.php` if you want to customize it.

---

### Topbar

[](#topbar)

```
'topbar' => [
    'limit' => 8,
],
```

OptionDescriptionlimitnotifications shown in dropdown---

### Realtime

[](#realtime)

```
'realtime' => [
    'enabled'         => true,
    'resolver'        => \RohitShakya\Beacon\Support\DefaultChannelResolver::class,
    'channel_pattern' => '{class}.{id}',
    'channels'        => [
        // \App\Models\User::class => 'App.Models.User.{id}',
    ],
    'browser_event'   => 'beacon:notification',
],
```

OptionDescriptionenabledEnable Echo listeningresolverFQCN that resolves the broadcast channel for a given notifiable (see *Custom Channel Resolver*)channel\_patternDefault pattern used by `DefaultChannelResolver`. `{class}` is replaced with the FQCN (`\\` → `.`); `{id}` with the keychannelsPer-class overrides keyed by FQCN. Wins over `channel_pattern` when the notifiable matchesbrowser\_eventEvent fired in the browser#### Per-class override example

[](#per-class-override-example)

```
'realtime' => [
    'channels' => [
        \App\Models\Reseller::class => 'tenants.{id}.reseller',
        \App\Models\Employee::class => 'org.employee.{id}',
    ],
],
```

---

### Custom Channel Resolver

[](#custom-channel-resolver)

Beacon resolves the broadcast channel **server-side** for the notifiable that the topbar/inbox is rendered for, then ships the channel name to the frontend through the Livewire props. The browser never has to figure out the channel name — and you can derive the channel from anything you have access to in PHP (tenant, organization, custom user key, etc.).

#### 1. Implement the contract

[](#1-implement-the-contract)

```
namespace App\Beacon;

use RohitShakya\Beacon\Support\Contracts\ChannelResolver;

class TenantChannelResolver implements ChannelResolver
{
    public function resolve($notifiable = null): ?string
    {
        $notifiable = $notifiable ?: auth()->user();
        if (! $notifiable) {
            return null;
        }

        // Whatever runtime logic you need — DB lookup, tenant scope, etc.
        return sprintf(
            'tenants.%s.%s.%s',
            tenant()->id,
            str_replace('\\', '.', $notifiable::class),
            $notifiable->getKey(),
        );
    }
}
```

Return `null` when there is no notifiable; the frontend will skip Echo binding cleanly.

#### 2. Point the config at it

[](#2-point-the-config-at-it)

```
// config/beacon.php
'realtime' => [
    'enabled'  => true,
    'resolver' => \App\Beacon\TenantChannelResolver::class,
    // channel_pattern / channels are ignored — your resolver controls the name
],
```

The resolver is a string FQCN, so `php artisan config:cache` continues to work.

#### 3. That's it

[](#3-thats-it)

The package's topbar view receives the resolved channel as a Livewire prop and passes it to `window.beaconTopbarBind(channel, eventName)` automatically. You do **not** need to call `beaconTopbarBind` from your own `app.js`.

---

Customizing UI
--------------

[](#customizing-ui)

Publish views:

```
php artisan vendor:publish --tag=beacon-views
```

Then edit:

```
resources/views/vendor/beacon/

```

You can redesign everything.

---

Browser Events
--------------

[](#browser-events)

Beacon dispatches:

```
beacon:notification

```

Example:

```
window.addEventListener('beacon:notification', e => {
    toast(e.detail.title)
})
```

When multiple topbars are mounted (different notifiables), each one binds its own private channel and fires the same event — `e.detail` carries the notification payload as it arrived from Echo.

---

Testing Notifications
---------------------

[](#testing-notifications)

```
$user->notify(new TestNotification());
$reseller->notify(new TestNotification());
```

Open two tabs → watch realtime.

---

Use Cases
---------

[](#use-cases)

- SaaS dashboards (per-user bell)
- Admin panels (impersonate / view another notifiable's bell)
- HR systems (employee notifications)
- CRM (account manager + contact notifications)
- ISP / reseller panels (reseller-scoped bells)
- Any Laravel app needing notifications

---

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

[](#contributing)

PRs welcome.

```
git clone
composer install
npm install
```

---

License
-------

[](#license)

MIT

---

Author
------

[](#author)

Built with ❤️ for Laravel ecosystem.

###  Health Score

43

—

FairBetter than 89% of packages

Maintenance86

Actively maintained with recent releases

Popularity16

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

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

Recently: every ~10 days

Total

8

Last Release

75d ago

Major Versions

1.0.1 → 2.0.02026-03-09

### Community

Maintainers

![](https://www.gravatar.com/avatar/6977729bd5d96c8c94e678f1f27114d44c135a6b2995548998932205d0eb1bbb?d=identicon)[rohitshakyaa](/maintainers/rohitshakyaa)

---

Tags

laravelnotificationswebsocketlaravel-packagebladelivewirerealtimedashboardsaastopbartailwindcssadmin-panelinboxlaravel-echonotification-ui

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/rohitshakya-laravel-beacon/health.svg)

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

###  Alternatives

[spatie/laravel-health

Monitor the health of a Laravel application

88212.7M189](/packages/spatie-laravel-health)[tallstackui/tallstackui

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

731189.9k16](/packages/tallstackui-tallstackui)[mati365/ckeditor5-livewire

CKEditor 5 integration for Laravel Livewire

469.2k](/packages/mati365-ckeditor5-livewire)[anousss007/vigilance

A driver-agnostic control center for Laravel queues, jobs, commands and the scheduler. Monitor what ran (with parameters), see failures, and dispatch jobs or run artisan commands manually from a self-contained dashboard.

1939.9k](/packages/anousss007-vigilance)[tomshaw/electricgrid

A feature-rich Livewire package designed for projects that require dynamic, interactive data tables.

119.8k](/packages/tomshaw-electricgrid)[api-platform/laravel

API Platform support for Laravel

58190.1k21](/packages/api-platform-laravel)

PHPackages © 2026

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