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.

Validation

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

<?php

use League\Uri\Schemes\Ws as WsUri;

$uri = WsUri::createFromString('wss://thephpleague.com/path/to?here#content');
// 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.