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

ActiveLibrary

pletfix/websocket-plugin
========================

Web Socket Plugin for Pletfix

11PHP

Since Oct 15Pushed 8y ago1 watchersCompare

[ Source](https://github.com/pletfix/websocket-plugin)[ Packagist](https://packagist.org/packages/pletfix/websocket-plugin)[ RSS](/packages/pletfix-websocket-plugin/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Web Socket for Pletfix
======================

[](#web-socket-for-pletfix)

About This
----------

[](#about-this)

This plugin provides a smart web socket solution. It's based on [Ratchet](http://socketo.me/), a PHP library to build
web socket server.

Supported Browser
-----------------

[](#supported-browser)

- Chrome
- IE 10 and above
- Firefox
- Safari
- Opera
- iOS Safari
- Android Browser 4.4 and above
- Chrome for Android

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

[](#requirements)

[ZeroMQ](http://zeromq.org/bindings:php) is require to push messages from web server to the clients.

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

[](#installation)

Fetch the package by running the following terminal command under the application's directory:

```
composer require pletfix/websocket-plugin

```

After downloading, enter this command in your terminal to register the plugin:

```
php console plugin pletfix/websocket-plugin

```

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

[](#configuration)

By default the TCP port 1111 is used for the web socket and 5555 to push messages. You may open the configuration file `./config/websocket.php` under the application's directory and override the defaults, if you have a port conflict on your system.

Usage
-----

[](#usage)

### Start the Web Socket Server

[](#start-the-web-socket-server)

[![Screenshot Server](https://raw.githubusercontent.com/pletfix/websocket-plugin/master/screenshot1.png)](https://raw.githubusercontent.com/pletfix/websocket-plugin/master/screenshot1.png)

Start the web socket server via shell:

```
php console websocket:serve
```

Of course, you can run the process in the background like this:

```
php console websocket:serve > /dev/null 2>&1 &
```

### Web Socket Example

[](#web-socket-example)

[![Screenshot Example](https://raw.githubusercontent.com/pletfix/websocket-plugin/master/screenshot2.png)](https://raw.githubusercontent.com/pletfix/websocket-plugin/master/screenshot2.png)

First, to be able to call the example, add this route entries into `boot/routes.php`:

```
$router->get('websocket/chat', 'WebSocketController@chat');
$router->get('websocket/push', 'WebSocketController@push');

```

> Note, that the routes are deliberately has not installed by the registration procedure, because that are only needed for the example. Don't forget to remove the routes when you no longer need the example.

Call the example via browser (preferably with two so that you can send messages back and forth :-)

```
https:///websocket/chat
```

You can push the current time from the web server to the clients with this URL:

```
https:///websocket/push
```

### Web Socket Service

[](#web-socket-service)

You can use the `websocket()` function to push a message from the web server to the web socket server:

```
websocket()->push('Hello World');

```

Customize
---------

[](#customize)

### Web Socket Server

[](#web-socket-server)

To add your own behavior to your web socket, create a web socket handler that implements the interface `Pletfix\WebSocket\Handler\Contracts\WebSocketHandler`. A good place for your handler is the `app/Handler` folder.

For a quick start look at the example `vendor/pletfix/websocket-plugin/src/Handler/WebSocketHandler.php`.

After then, add an entry "websocket-handler" into `boot/services.php` to inject your handler into the dependency container. For example, if the class name of your handler is `\App\Handler\WebSocketHandler`, add the following entry:

```
$di->set('websocket-handler', \App\Handler\WebSocketHandler::class, true);

```

### Web Socket Client

[](#web-socket-client)

Copy the view `vendor/pletfix/websocket-plugin/views/chat.blade.php` to `resources/view/websocket/chat.blade.php`, where you can modify the view as you wish.

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/64489babc88aa87c56b4097f2a4fe20233d1a3ee63ce0da7c2cc2f97a883f444?d=identicon)[frohlfing](/maintainers/frohlfing)

---

Top Contributors

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

### Embed Badge

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

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

PHPackages © 2026

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