Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
laravel-reverb-websockets
laravel-reverb-websockets
alizharb/agent-skills
claude-code
reverb
websockets
broadcasting
laravel-echo
events
private-channels

Use when setting up, configuring, or debugging real-time broadcasting and websockets using Laravel Reverb and Echo.

Install
php artisan boost:add-skill alizharb/agent-skills

Save this content to: .claude/skills/laravel-reverb-websockets/SKILL.md

# Laravel Reverb Websockets

## When To Use

Use this skill when implementing real-time updates, chat systems, live notifications, or dashboard stat updates using Laravel Reverb and Laravel Echo.

## Workflow

1. **Verify installation**: Ensure Reverb configuration exists (`config/reverb.php`).
2. **Channel definition**: Specify broadcast channels and authorized access rules inside `routes/channels.php`.
3. **Configure the Event**: Ensure event implements `ShouldBroadcast` or `ShouldBroadcastNow`.
4. **Trigger Event**: Broadcast the event safely via standard event dispatches.
5. **Echo Client Integration**: Setup frontend Echo client listener bindings for private/presence channels.

## Examples

### Good Example

```php
// app/Events/MessageSent.php
namespace App\Events;

use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Queue\SerializesModels;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Broadcasting\PrivateChannel;

final class MessageSent implements ShouldBroadcast
{
    use Dispatchable, SerializesModels;

    public function __construct(public string $message, public int $userId) {}

    public function broadcastOn(): array
    {
        return [
            new PrivateChannel("chat.user.{$this->userId}"),
        ];
    }
}
```

```php
// routes/channels.php
Broadcast::channel('chat.user.{id}', function (User $user, int $id) {
    return $user->id === $id;
});
```

### Bad Example

```php
// ❌ Using public broadcast channels for sensitive data, or using custom HTTP calls for real-time updates.
public function triggerUpdate(Request $request) {
    Http::post('http://localhost:3000/trigger', $request->all());
}
```

Laravel Reverb Websockets

When To Use

Use this skill when implementing real-time updates, chat systems, live notifications, or dashboard stat updates using Laravel Reverb and Laravel Echo.

Workflow

  1. Verify installation: Ensure Reverb configuration exists (config/reverb.php).
  2. Channel definition: Specify broadcast channels and authorized access rules inside routes/channels.php.
  3. Configure the Event: Ensure event implements ShouldBroadcast or ShouldBroadcastNow.
  4. Trigger Event: Broadcast the event safely via standard event dispatches.
  5. Echo Client Integration: Setup frontend Echo client listener bindings for private/presence channels.

Examples

Good Example

// app/Events/MessageSent.php
namespace App\Events;

use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Queue\SerializesModels;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Broadcasting\PrivateChannel;

final class MessageSent implements ShouldBroadcast
{
    use Dispatchable, SerializesModels;

    public function __construct(public string $message, public int $userId) {}

    public function broadcastOn(): array
    {
        return [
            new PrivateChannel("chat.user.{$this->userId}"),
        ];
    }
}
// routes/channels.php
Broadcast::channel('chat.user.{id}', function (User $user, int $id) {
    return $user->id === $id;
});

Bad Example

// ❌ Using public broadcast channels for sensitive data, or using custom HTTP calls for real-time updates.
public function triggerUpdate(Request $request) {
    Http::post('http://localhost:3000/trigger', $request->all());
}
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
mehedimi/laravel-amp-mail
happones/laravel-vue-i18n-generator
jwerd/inertia-table
siberfx/flysystem-wasabi
hollyit/token-replace
ippanelcom/laravel-sdk
adachsoft/changelog-linter
adachsoft/collection
payerurl/telegrambot-crypto-payment-instant-payout
dskripchenko/laravel-hybrid-search
riorizkyrainey/lara-ced
mehedimi/static-vel
zharp/zharp
nonsapiens/bigquery-model-sync
lgu-bayambang-ict-office/lgu-laravel-development-standards
andydefer/laravel-support
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel