PHPackages                             sentixtech/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. [HTTP &amp; Networking](/categories/http)
4. /
5. sentixtech/websocket

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

sentixtech/websocket
====================

Advanced WebSocket package for Laravel with broadcasting capabilities

1.0.1(1y ago)07MITPHPPHP ^7.4|^8.0

Since Jan 26Pushed 1y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (4)Used By (0)

SentixTech WebSocket Package for Laravel
========================================

[](#sentixtech-websocket-package-for-laravel)

Overview
--------

[](#overview)

A powerful, flexible WebSocket implementation for Laravel applications, enabling real-time communication across various use cases.

Features
--------

[](#features)

- Dynamic channel creation
- Flexible subscription management
- Generic event broadcasting
- User-specific and global messaging
- Comprehensive error handling
- Detailed logging

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

[](#installation)

### Composer Installation

[](#composer-installation)

```
composer require sentixtech/websocket
```

### Publish Configuration

[](#publish-configuration)

```
php artisan vendor:publish --provider="SentixTech\WebSocket\WebSocketServiceProvider"
```

### Configure WebSocket Server

[](#configure-websocket-server)

Edit `config/websocket.php`:

```
return [
    'host' => env('WEBSOCKET_HOST', 'localhost'),
    'port' => env('WEBSOCKET_PORT', 8080),
    'max_clients' => env('WEBSOCKET_MAX_CLIENTS', 1000),
    'max_frame_size' => env('WEBSOCKET_MAX_FRAME_SIZE', 1024 * 1024), // 1MB
];
```

### Start WebSocket Server

[](#start-websocket-server)

```
php artisan websocket:serve
```

Usage Examples
--------------

[](#usage-examples)

### Channel Management

[](#channel-management)

```
// Create channels
WebSocket::createChannel('notifications');
WebSocket::createChannel('user_events');
```

### Subscription

[](#subscription)

```
// Subscribe a client to a channel
WebSocket::subscribe($socketResource, 'notifications', $userId);

// Unsubscribe from a channel
WebSocket::unsubscribe($socketResource, 'notifications', $userId);
```

### Broadcasting

[](#broadcasting)

```
// Broadcast to all channel subscribers
WebSocket::broadcast('notifications', [
    'type' => 'alert',
    'message' => 'System maintenance in 10 minutes'
]);

// Broadcast to specific users
WebSocket::broadcast('notifications', $message, [
    'users' => [1, 2, 3] // Only send to these user IDs
]);
```

### Event Emission

[](#event-emission)

```
// Emit a generic event
WebSocket::emit('user_login', [
    'user_id' => 123,
    'timestamp' => now()
]);
```

### Channel Monitoring

[](#channel-monitoring)

```
// Get number of channel subscribers
$subscriberCount = WebSocket::subscribers('notifications');
```

Advanced Usage
--------------

[](#advanced-usage)

### Real-time Notifications

[](#real-time-notifications)

```
// Send a notification to specific users
WebSocket::broadcast('notifications', [
    'title' => 'New Message',
    'content' => 'You have a new message from John',
    'user_ids' => [5, 10] // Only notify these users
]);
```

### Chat System Integration

[](#chat-system-integration)

```
// Send a chat message
WebSocket::broadcast('chat_room_1', [
    'sender_id' => Auth::id(),
    'message' => $messageContent
]);
```

Security
--------

[](#security)

- Supports user-specific channel subscriptions
- Flexible access control
- Comprehensive error logging

Performance
-----------

[](#performance)

- Non-blocking socket implementation
- Configurable max clients and frame size
- Efficient channel and user management

Error Handling
--------------

[](#error-handling)

All methods return boolean or integer status:

- `createChannel()`: Returns `true/false`
- `subscribe()`: Returns `true/false`
- `broadcast()`: Returns number of successful broadcasts
- `emit()`: Returns number of successful event emissions

Troubleshooting
---------------

[](#troubleshooting)

- Check `storage/logs/laravel.log` for WebSocket errors
- Ensure WebSocket server is running
- Verify configuration in `config/websocket.php`

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

[](#requirements)

- PHP 7.4+
- Laravel 8.0+
- Sockets extension

Contributing
------------

[](#contributing)

Contributions are welcome! Please submit pull requests to the repository.

License
-------

[](#license)

MIT License

Support
-------

[](#support)

For issues and support, please open a GitHub issue in the repository.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance42

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity45

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

2

Last Release

477d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/78f46d95ab25fd181bfa49148d0f1d9193dac8bc237fd951fb630fd32f64de8d?d=identicon)[Sentix](/maintainers/Sentix)

---

Top Contributors

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

### Embed Badge

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

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

###  Alternatives

[friendsofsymfony/rest-bundle

This Bundle provides various tools to rapidly develop RESTful API's with Symfony

2.8k73.3M319](/packages/friendsofsymfony-rest-bundle)[php-http/discovery

Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations

1.3k309.5M1.2k](/packages/php-http-discovery)[pusher/pusher-php-server

Library for interacting with the Pusher REST API

1.5k94.8M293](/packages/pusher-pusher-php-server)[react/http

Event-driven, streaming HTTP client and server implementation for ReactPHP

78026.4M414](/packages/react-http)[php-http/curl-client

PSR-18 and HTTPlug Async client with cURL

48347.0M384](/packages/php-http-curl-client)[smi2/phpclickhouse

PHP ClickHouse Client

84310.1M71](/packages/smi2-phpclickhouse)

PHPackages © 2026

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