Download the PHP package rohitshakya/laravel-beacon without Composer
On this page you can find all versions of the php package rohitshakya/laravel-beacon. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download rohitshakya/laravel-beacon
More information about rohitshakya/laravel-beacon
Files in rohitshakya/laravel-beacon
Package laravel-beacon
Short Description Realtime notification UI for Laravel with topbar dropdown, inbox, and Livewire + Echo support. Fully customizable and production ready.
License MIT
Informations about the package laravel-beacon
🔔 Beacon
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"?
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
- 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'sNotifiabletrait - 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
Publish config:
Publish views (optional):
Quick Usage
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
Pass any model that uses the Notifiable trait:
Or via the Livewire tag with explicit class + id:
The same applies to the inbox:
Security note: the
notifiableClassandnotifiableIdprops 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
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:
2. Send a notification
Beacon will automatically appear in UI for whoever the topbar is mounted for.
3. Listen in JS (optional)
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:
| Notifiable | Channel |
|---|---|
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
config/beacon.php
Config Options Explained
Views
Override the inbox and per-item Blade templates.
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
| Option | Description |
|---|---|
| limit | notifications shown in dropdown |
Realtime
| Option | Description |
|---|---|
| enabled | Enable Echo listening |
| resolver | FQCN that resolves the broadcast channel for a given notifiable (see Custom Channel Resolver) |
| channel_pattern | Default pattern used by DefaultChannelResolver. {class} is replaced with the FQCN (\\ → .); {id} with the key |
| channels | Per-class overrides keyed by FQCN. Wins over channel_pattern when the notifiable matches |
| browser_event | Event fired in the browser |
Per-class override example
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
Return null when there is no notifiable; the frontend will skip Echo binding
cleanly.
2. Point the config at it
The resolver is a string FQCN, so php artisan config:cache continues to work.
3. That's 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
Publish views:
Then edit:
You can redesign everything.
Browser Events
Beacon dispatches:
Example:
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
Open two tabs → watch realtime.
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
PRs welcome.
License
MIT
Author
Built with ❤️ for Laravel ecosystem.
All versions of laravel-beacon with dependencies
illuminate/support Version ^10.0|^11.0|^12.0|^13.0
illuminate/notifications Version ^10.0|^11.0|^12.0|^13.0
livewire/livewire Version ^3.0|^4.0