PHPackages                             amarwave/amarwave-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. amarwave/amarwave-laravel

ActiveLibrary[API Development](/categories/api)

amarwave/amarwave-laravel
=========================

Laravel service provider, facade, and broadcasting driver for AmarWave real-time messaging.

00PHP

Since Apr 9Pushed 2mo agoCompare

[ Source](https://github.com/amarwave/amarwave-laravel)[ Packagist](https://packagist.org/packages/amarwave/amarwave-laravel)[ RSS](/packages/amarwave-amarwave-laravel/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependenciesVersions (1)Used By (0)

amarwave-laravel
================

[](#amarwave-laravel)

Laravel service provider, facade, and broadcasting driver for [AmarWave](https://github.com/amarwave/amarwave) real-time messaging.

This package wraps [`amarwave/amarwave-php`](../php) and wires it into the Laravel framework.

---

Requirements
------------

[](#requirements)

- PHP 8.1+
- Laravel 10, 11, or 12

---

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

[](#installation)

```
composer require amarwave/amarwave-laravel
```

Laravel auto-discovers the service provider and facade. No manual registration needed.

---

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

[](#configuration)

Publish the config file:

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

Add to your `.env`:

```
AMARWAVE_APP_KEY=your-app-key
AMARWAVE_APP_SECRET=your-app-secret
AMARWAVE_CLUSTER=default
AMARWAVE_TIMEOUT=10
```

---

Usage
-----

[](#usage)

### Facade

[](#facade)

```
use AmarWave\Laravel\AmarWave;

AmarWave::trigger('orders', 'placed', ['order_id' => 42]);

AmarWave::triggerBatch([
    ['channel' => 'chat-1', 'event' => 'message', 'data' => ['text' => 'Hello']],
    ['channel' => 'chat-2', 'event' => 'message', 'data' => ['text' => 'World']],
]);
```

Or with the global alias:

```
\AmarWave::trigger('orders', 'placed', ['order_id' => 42]);
```

### Dependency Injection

[](#dependency-injection)

```
use AmarWave\AmarWave;

class OrderController extends Controller
{
    public function __construct(private readonly AmarWave $aw) {}

    public function store(Request $request): JsonResponse
    {
        $order = Order::create($request->validated());
        $this->aw->trigger('orders', 'placed', $order->toArray());
        return response()->json($order, 201);
    }
}
```

---

Broadcasting Driver
-------------------

[](#broadcasting-driver)

Use AmarWave as a Laravel broadcasting driver so `broadcast(new YourEvent)` works out of the box.

**1 — Add the connection to `config/broadcasting.php`**

```
'connections' => [
    'amarwave' => [
        'driver' => 'amarwave',
    ],
],
```

**2 — Set the driver in `.env`**

```
# Laravel 10
BROADCAST_DRIVER=amarwave
# Laravel 11+
BROADCAST_CONNECTION=amarwave
```

**3 — Create a broadcastable event**

```
namespace App\Events;

use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;

class OrderPlaced implements ShouldBroadcast
{
    public function __construct(public readonly array $order) {}

    public function broadcastOn(): array
    {
        return [
            new Channel('orders'),
            new PrivateChannel("user.{$this->order['user_id']}"),
        ];
    }

    public function broadcastAs(): string { return 'order.placed'; }

    public function broadcastWith(): array
    {
        return ['order_id' => $this->order['id'], 'total' => $this->order['total']];
    }
}
```

**4 — Dispatch**

```
broadcast(new OrderPlaced($order));
```

---

Channel Authorization
---------------------

[](#channel-authorization)

In `routes/channels.php`:

```
use Illuminate\Support\Facades\Broadcast;

Broadcast::channel('user.{id}', function ($user, $id) {
    return (int) $user->id === (int) $id;
});

Broadcast::channel('presence-room.{roomId}', function ($user, $roomId) {
    $room = \App\Models\Room::find($roomId);
    if ($room?->members()->where('user_id', $user->id)->exists()) {
        return ['id' => $user->id, 'name' => $user->name];
    }
    return false;
});
```

---

License
-------

[](#license)

MIT

###  Health Score

19

—

LowBetter than 9% of packages

Maintenance56

Moderate activity, may be stable

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity12

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/55060201?v=4)[fnnaeem](/maintainers/fnnaeem)[@FNnaeem](https://github.com/FNnaeem)

---

Top Contributors

[![fnnaeem1881](https://avatars.githubusercontent.com/u/77448606?v=4)](https://github.com/fnnaeem1881 "fnnaeem1881 (4 commits)")

### Embed Badge

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

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

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35816.3M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24015.5M18](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172437.8k11](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

93452.6k6](/packages/botman-driver-telegram)[pixelant/pxa-social-feed

Add Facebook, Instagram, and Twitter feeds to your site.

2349.3k](/packages/pixelant-pxa-social-feed)

PHPackages © 2026

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