PHPackages                             mita/uranus-socket-server - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. mita/uranus-socket-server

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

mita/uranus-socket-server
=========================

A PHP Socket Server Library using Ratchet

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

Since Aug 14Pushed 1y ago1 watchersCompare

[ Source](https://github.com/mita9497dev/Uranus-Socket-Server)[ Packagist](https://packagist.org/packages/mita/uranus-socket-server)[ RSS](/packages/mita-uranus-socket-server/feed)WikiDiscussions main Synced today

READMEChangelog (2)Dependencies (5)Versions (3)Used By (0)

Here is a revised and more structured version of the **UranusSocketServer** documentation, now including additional sections on configuring routes, creating controllers, and understanding packet structure after the connection is established:

---

UranusSocketServer
==================

[](#uranussocketserver)

**UranusSocketServer** is a powerful, scalable, and easy-to-use PHP library designed for building high-performance WebSocket applications. With features like a flexible middleware pipeline, comprehensive event management, and efficient connection handling, UranusSocketServer empowers developers to create sophisticated WebSocket solutions effortlessly.

Features
--------

[](#features)

- **Modular Architecture**: Easily extend and customize your WebSocket server.
- **Dependency Injection**: Fully DI-compliant for clean and maintainable code.
- **Scalability**: Efficiently handles numerous simultaneous WebSocket connections.
- **Customizable Routing**: Route messages to controllers with support for middleware.
- **Event-Driven**: Hook into key lifecycle events for enhanced control.

Quick Start Guide
-----------------

[](#quick-start-guide)

### 1. Installation

[](#1-installation)

Install the library using Composer:

```
composer require mita/uranus-socket-server
```

### 2. Configuration

[](#2-configuration)

#### 2.1 Setting Up Routes

[](#21-setting-up-routes)

Create a `routes.yaml` file to define your WebSocket routes:

```
join_room:
    path: /room/{roomId}/join
    controller: Mita\UranusSocketServer\Examples\Chat\Controllers\ChatController

room_publish:
    path: /room/{roomId}/publish
    controller: Mita\UranusSocketServer\Examples\Chat\Controllers\ChatController
```

#### 2.2 Creating a Controller

[](#22-creating-a-controller)

Create a controller to handle incoming WebSocket messages:

```
