Download the PHP package componenta/websocket-server without Composer

On this page you can find all versions of the php package componenta/websocket-server. 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 websocket-server

Componenta WebSocket Server

WebSocket server, protocol, socket, and connection primitives for Componenta. The package contains the low-level server runtime and application contracts; componenta/websocket-app connects it to the Componenta application boot process.

Installation

The package requires PHP ^8.4, componenta/config, componenta/http, psr/clock, and PSR-11.

Application Contract

Implement WebSocketApplicationInterface to handle lifecycle events:

Connections expose immutable connection data and controlled write methods through ConnectionInterface:

API Meaning
$connection->id Framework connection id.
$connection->remoteAddress Remote socket address.
$connection->request Parsed WebSocket handshake request.
$connection->context Mutable connection context object.
$connection->state Current connection state.
$connection->send(Message|string $message) Queue an existing Message or a text string.
$connection->sendText(string $payload) Queue a text message.
$connection->sendBinary(string $payload) Queue a binary message.
$connection->close(int $code, string $reason) Queue a close frame and move the connection toward closing.

Write methods return SendResult. Check $result->accepted before assuming the payload was queued; rejected results include a $reason and the current $queuedBytes value.

Message Routing

For applications that only need message dispatch, use RoutedWebSocketApplication with a MessageRouterInterface:

RoutedWebSocketApplication adds connections to the registry on connect, delegates incoming messages to the router, and removes connections on disconnect. Application exceptions are reported through SafeWebSocketApplicationInvoker, which calls WebSocketApplicationInterface::failed() instead of letting handler failures escape the server loop.

Configuration

WebSocketOptions::fromConfig() reads keys from Componenta\WebSocket\Config\ConfigKey:

Key Default
HOST 127.0.0.1
PORT 8080
PATH /ws
ALLOWED_ORIGINS ['*']
MAX_FRAME_PAYLOAD_SIZE 1048576
MAX_MESSAGE_PAYLOAD_SIZE 1048576
HEARTBEAT_INTERVAL_MS 30000
PONG_TIMEOUT_MS 10000
MAX_CONNECTIONS 1024

Additional keys control outgoing buffer size, pending handshakes, idle timeout, shutdown drain timeout, select timeout, and listen backlog.

Registered Services

Componenta\WebSocket\ConfigProvider registers defaults for:

The default server uses stream sockets and a select-based event loop.

Boundary

This package does not provide application entry points, config/websocket.php loading, or Componenta bootloader registration. Use componenta/websocket-app for Componenta application integration.

Supervisor contracts such as WorkerInterface, WorkerRegistryInterface, and WorkerMessageBusInterface are declared here because they describe the socket server runtime. A concrete multi-process supervisor is an application/deployment concern.


All versions of websocket-server with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
componenta/arrayable Version ^1.0
componenta/config Version ^2.0.2
componenta/http Version ^1.0
psr/clock Version ^1.0
psr/container Version ^2.0
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 componenta/websocket-server contains the following files

Loading the files please wait ...