The League of Extraordinary Packages

Our Packages:

Presented by The League of Extraordinary Packages

Getting Started

Uri parser

Uri schemes

Uri manipulations

Uri components

Upgrading Guide

Websockets URI

To work with websockets URIs you can use the League\Uri\Schemes\Ws class. This class handles secure and non secure websockets URI.


The scheme of a Websocket URI must be equal to ws, wss or be undefined. It can not contain a fragment component as per RFC6455.

Adding contents to the fragment component throws an UriException exception


use League\Uri\Schemes\Ws as WsUri;

$uri = WsUri::createFromString('wss://');
// will throw an League\Uri\Schemes\UriException

Apart from the fragment and the scheme definition, the websockets URIs share the same validation rules as Http URIs.