PHPackages                             ankurjha/comnestor - 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. ankurjha/comnestor

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

ankurjha/comnestor
==================

Comnestor broadcasting driver for Laravel

v1.0.9(1mo ago)014MITPHPPHP ^8.1

Since Mar 15Pushed 1mo agoCompare

[ Source](https://github.com/ankurjhaaa/comnestor-broadcasting)[ Packagist](https://packagist.org/packages/ankurjha/comnestor)[ RSS](/packages/ankurjha-comnestor/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (11)Used By (0)

Comnestor Broadcasting Driver
=============================

[](#comnestor-broadcasting-driver)

[![Latest Version on Packagist](https://camo.githubusercontent.com/c908bc22533242c767556c674e070bd8848cf15029a60e942bb330405018ea22/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616e6b75726a68612f636f6d6e6573746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ankurjha/comnestor)[![Total Downloads](https://camo.githubusercontent.com/1c2d0d55e320c7ab6d969a34a31f760c19911653ec2db343bade0f7ee3911aef/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616e6b75726a68612f636f6d6e6573746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ankurjha/comnestor)[![License: MIT](https://camo.githubusercontent.com/784362b26e4b3546254f1893e778ba64616e362bd6ac791991d2c9e880a3a64e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e2e737667)](LICENSE)[![Health Score](https://camo.githubusercontent.com/8eb994f05fb9f1891657a3dfee467c88a56b742786af95abbfdc2c97755c2dff/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4865616c746825323053636f72652d412d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ankurjha/comnestor)[![Tests](https://camo.githubusercontent.com/646b3633d27f3efeffd80a61e47912af4a3fdfdee925bb4bc33018f805ae298e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f54657374732d4e6f74253230436f6e666967757265642d6c69676874677265792e7376673f7374796c653d666c61742d737175617265)](#troubleshooting)

Comnestor Broadcasting Driver is a Laravel broadcasting driver for sending realtime events through Comnestor websocket infrastructure.

With this package, your Laravel app can broadcast events using the standard `ShouldBroadcast` pattern. The `comnestor` driver forwards those events to the Comnestor API, and Comnestor delivers them to websocket clients.

Package name: `ankurjha/comnestor`

> Note: The tests badge is currently a placeholder. Once CI is added, replace it with your real workflow status badge.

---

Table of Contents
-----------------

[](#table-of-contents)

- [Key Features](#key-features)
- [Requirements](#requirements)
- [Quick Start](#quick-start)
- [Step 1: Install via Composer](#step-1-install-via-composer)
- [Step 2: Run Installer Command](#step-2-run-installer-command)
- [Step 3: Configure Environment Variables](#step-3-configure-environment-variables)
- [Step 4: Verify Broadcasting Configuration](#step-4-verify-broadcasting-configuration)
- [Step 5: Create a Broadcast Event](#step-5-create-a-broadcast-event)
- [Step 6: Trigger the Event](#step-6-trigger-the-event)
- [Step 7: Listen from JavaScript](#step-7-listen-from-javascript)
- [How Realtime Broadcasting Works](#how-realtime-broadcasting-works)
- [Troubleshooting](#troubleshooting)
- [License](#license)

---

Key Features
------------

[](#key-features)

- Custom Laravel broadcasting driver named `comnestor`
- Uses native Laravel broadcasting with `ShouldBroadcast`
- Signed API requests from Laravel to Comnestor
- Easy setup with `php artisan comnestor:install`
- Works with Laravel broadcasting conventions similar to Pusher, Ably, and Reverb

---

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

[](#requirements)

- PHP `^8.1`
- Laravel `10`, `11`, or `12`

---

Quick Start
-----------

[](#quick-start)

```
composer require ankurjha/comnestor
php artisan comnestor:install
```

Then set these values in `.env`:

```
BROADCAST_CONNECTION=comnestor

COMNESTOR_BASE_URL=https://www.comnestor.cloud
COMNESTOR_APP_KEY=your-app-key
COMNESTOR_APP_SECRET=your-app-secret
```

You can now dispatch Laravel broadcast events normally.

---

Step 1: Install via Composer
----------------------------

[](#step-1-install-via-composer)

Install the package in your Laravel app:

```
composer require ankurjha/comnestor
```

---

Step 2: Run Installer Command
-----------------------------

[](#step-2-run-installer-command)

Run the package installer:

```
php artisan comnestor:install
```

This command will:

1. Create `app/Services/ComnestorBroadcasting.php`
2. Ensure `config/broadcasting.php` exists
3. Add a `comnestor` connection in broadcasting config

---

Step 3: Configure Environment Variables
---------------------------------------

[](#step-3-configure-environment-variables)

Add or update these variables in your `.env` file:

```
BROADCAST_CONNECTION=comnestor

COMNESTOR_BASE_URL=https://www.comnestor.cloud
COMNESTOR_APP_KEY=your-app-key
COMNESTOR_APP_SECRET=your-app-secret
```

Variable reference:

- `BROADCAST_CONNECTION`: selects the active Laravel broadcast driver
- `COMNESTOR_BASE_URL`: Comnestor API base URL (use `https` in production)
- `COMNESTOR_APP_KEY`: public identifier for your app
- `COMNESTOR_APP_SECRET`: private secret used to sign API requests

---

Step 4: Verify Broadcasting Configuration
-----------------------------------------

[](#step-4-verify-broadcasting-configuration)

After installation, `config/broadcasting.php` should include this connection:

```
'connections' => [

        'comnestor' => [
                'driver' => 'comnestor',
                'base_url' => env('COMNESTOR_BASE_URL'),
                'app_key' => env('COMNESTOR_APP_KEY'),
                'app_secret' => env('COMNESTOR_APP_SECRET'),
        ],

],
```

If you update environment variables, clear cached config:

```
php artisan optimize:clear
```

---

Step 5: Create a Broadcast Event
--------------------------------

[](#step-5-create-a-broadcast-event)

Create an event implementing `ShouldBroadcast`.

```
