Download the PHP package micilini/php-websockets without Composer

On this page you can find all versions of the php package micilini/php-websockets. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-websockets

PHPSockets

Native PHP WebSocket and realtime chat foundation built from scratch with PHP sockets. Works standalone with plain PHP or inside Laravel applications.

PHP 8.2+ Laravel 10/11/12/13 MIT License Tests Packagist

Pure PHP WebSockets. Realtime chat. Private rooms. Bots. Laravel-ready.


Application Images


Overview

PHPSockets started in 2016 as an educational experiment demonstrating how to build a WebSocket server directly with PHP sockets, without Node.js, without socket.io, and without a third-party realtime runtime.

The project has now been rebuilt as a modern Composer package for PHP 8.2+, with a clean architecture, WebSocket protocol primitives, a realtime server runtime, a chat kit, private conversations, private group rooms, small attachments, emoji-safe payloads, bot hooks, optional storage adapters, and Laravel integration.

The goal is not only to provide a chat example.

The goal is to provide a native PHP realtime foundation that developers can use to build:


Features


Installation

Install through Composer:

For local development:


Requirements

Required:

Optional:


Quick Start

Standalone PHP server

Create a simple WebSocket chat server:

Run it:

The WebSocket server will listen on:


Running the Examples

The example servers can be executed both from a cloned repository and from a project where the package was installed through Composer. The examples use examples/bootstrap.php to locate the correct Composer autoload file automatically.

Each example has two parts:

  1. a WebSocket server process;
  2. a browser UI served by PHP's built-in HTTP server.

EasyChat

Start the WebSocket server:

Open another terminal and serve the UI:

If you installed the package inside another project with Composer, run:

Open:

EasyChat demonstrates:


MediumChat

Start the WebSocket server:

Open another terminal and serve the UI:

If you installed the package inside another project with Composer, run:

Open:

MediumChat demonstrates everything from EasyChat plus:


PrivateChat

Start the WebSocket server:

Open another terminal and serve the UI:

If you installed the package inside another project with Composer, run:

Open:

PrivateChat demonstrates:

Try the bot commands:


Example Matrix

Example Global Chat Direct 1:1 Private Groups Attachments Bots Best For
EasyChat First contact and learning
MediumChat Events and callbacks
PrivateChat Advanced realtime chat

Laravel Integration

PHPSockets can be used inside Laravel applications through Composer package discovery.

Install the package:

Publish the configuration:

Check the package status:

Start the WebSocket chat server from Laravel:

Run SQL migrations when using a persistent storage driver:

The package registers:

Example usage:

Laravel is optional. The native PHP core continues to work standalone.


Running PHPSockets in a Laravel Project

A Laravel app usually has two running processes:

Run the WebSocket server:

In another terminal:

Then your Laravel pages can connect to:


Hosting the Examples Through Laravel Routes

For a Laravel demo app, you can keep PHPSockets as the engine and let Laravel serve the example screens.

Recommended local package structure while developing PHPSockets inside a Laravel app:

After installing from Packagist, the package will live under:

The idea is:

The WebSocket server still runs in a separate process, which is the correct model for realtime applications.


Configuration

After publishing the Laravel config, config/phpsockets.php contains:

Example .env:


API Overview

Main server

Server events

Available high-level events

Available low-level socket events


Storage

PHPSockets uses in-memory storage by default. This is perfect for examples, demos and development.

Available storage options:

SQLite migration example

Laravel migration command


Attachments

The examples support small file messages.

Attachment runtime directory

By default, PHPSockets stores temporary example attachments in a project-local directory:

You can override this location with:

This is especially useful for production deployments, Laravel apps, containers and Windows environments.

Supported MIME types:

Default max file size:

Attachment behavior:

The initial transport uses JSON text-frame envelopes with base64 payloads over WebSocket. Larger uploads should use a future HTTP upload flow with WebSocket metadata messages.


Bot Hooks

PHPSockets includes a lightweight bot layer.

Bots can listen to text messages and return a response in the same conversation context.

Supported contexts:

Example:

Register the bot:

Bots are intentionally simple in v1. They do not require any external AI API.


Protocol Notes

PHPSockets uses JSON text frames for chat messages.

Example client message:

Example server message:

Binary WebSocket frames are not accepted by the chat core in this version. File messages are transported as validated JSON text-frame envelopes.


Security Model

PHPSockets includes a practical safety baseline for examples and local-first applications:

This package is a realtime foundation. Production applications should still add authentication, authorization, HTTPS/WSS, monitoring, rate limiting, persistent storage and infrastructure hardening.


Project Structure


Testing and Quality

Install development dependencies:

Validate the package:

Run tests:

Run static analysis:

Check code style:

Fix code style:

Run the full quality pipeline:


Legacy Code

The original 2016 implementation is preserved under:

The legacy code is kept for historical and educational purposes only. The modern Composer package lives in src/ and does not depend on the old structure.


Roadmap

Current v1 focus:

Future ideas:


Packagist Release Checklist

Before tagging a stable release:

Then:

Submit the repository to Packagist:

After Packagist detects the package, users can install it with:

Repository:


License

PHPSockets is open-sourced software licensed under the MIT license.


Credits

Created and maintained by Micilini.

Originally created in 2016 and rebuilt as a modern native PHP realtime foundation in 2026.


All versions of php-websockets with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
ext-sockets Version *
ext-json Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package micilini/php-websockets contains the following files

Loading the files please wait ...