PHPackages                             raheelrafiq326/websocket - 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. raheelrafiq326/websocket

ActiveLibrary

raheelrafiq326/websocket
========================

Websocket support for laravel applications.

v1.0.1(2y ago)017MITPHP

Since Dec 1Pushed 2y ago1 watchersCompare

[ Source](https://github.com/raheelrafiq326/websocket)[ Packagist](https://packagist.org/packages/raheelrafiq326/websocket)[ Docs](https://github.com/raheelrafiq326/websocket)[ RSS](/packages/raheelrafiq326-websocket/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (4)Used By (0)

Websocket
=========

[](#websocket)

Documentation, Installation, and Usage Instructions
---------------------------------------------------

[](#documentation-installation-and-usage-instructions)

Introduction
------------

[](#introduction)

This package allows you to add socket server within a package.

Install library in laravel project.

```
composer require raheelrafiq326/websocket

```

Documentation
-------------

[](#documentation)

### Installation

[](#installation)

Publish config and js files in project.

```
php artisan vendor:publish --tag=websocket

```

```
php artisan websocket:serve

```

After installation add below command in schedule function in app\\Console\\Kernel.php (if want to add websocket server from cronjob).

```
protected function schedule(Schedule $schedule): void
{
    // call this command to be schedule
    $schedule->command('websocket:serve')->withoutOverlapping();
}
```

After this run scheduler (in development or local).

```
php artisan schedule:run

```

Add above command in cron job in server (production).

### Usage

[](#usage)

you can use below code to broadcast event from controller or any other class.

```
use RaheelRafiq326\Websocket\WebSocketClient;

// Change value with your channel name.
$channel = "";

// Change value with your event name.
$event = "";

// Chnage value according to your requirement.
$data = [
  "message" => "Hi"
];

// Call sendMessage function of WebSocketClient from package.
WebSocketClient::sendMessage($channel, $event, $data);
```

### Testing

[](#testing)

Run below command if you didn't publish js files.

```
php artisan vendor:publish --tag=websocket-js

```

You can test websocket connection using socket.js. Which was exported to public/vendor/websocket directory.

```

    // connect websocket
    const socket = new Socket("{{ config('websocket.host') }}")

    // check if socket connect successfully
    socket.onopen((event) => {
      console.log("onopen event ==> ", event)
    })

    // listen events
    socket.listen({
        channel: "",
        event: "",
        callback: (event) => {
            console.log("event listen ==> ", event)
        }
    })

```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Every ~0 days

Total

3

Last Release

890d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e2d8e4b7b572a72ab5ba79ae8be111a7a0360040e1f54dc850c51461a394c46a?d=identicon)[raheelrafiq326](/maintainers/raheelrafiq326)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/raheelrafiq326-websocket/health.svg)

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

###  Alternatives

[laravel-notification-channels/discord

Laravel notification driver for Discord.

2371.3M11](/packages/laravel-notification-channels-discord)[takielias/codeigniter-websocket

CodeIgniter Websocket using Ratchet Websocket technology. Inspired by https://github.com/romainrg/ratchet\_client

609.1k](/packages/takielias-codeigniter-websocket)[takielias/codeigniter4-websocket

Websocket using Ratchet Websocket technology for CodeIgniter 4

883.0k](/packages/takielias-codeigniter4-websocket)[romainrg/ratchet_client

CodeIgniter library who allow you to make powerfull applications with realtime interactions by using Websocket technology

396.6k](/packages/romainrg-ratchet-client)[joni-jones/yii2-wschat

Online chat based on web sockets and ratchet php

981.3k](/packages/joni-jones-yii2-wschat)[lion/bundle

Lion-framework configuration and initialization package

122.2k1](/packages/lion-bundle)

PHPackages © 2026

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