The League of Extraordinary Packages

Our Packages:

Presented by The League of Extraordinary Packages

Getting Started

Uri functions

Uri parser

Uri schemes

Uri manipulations

Uri components

Uri Domain Parser

Upgrading Guide

Websockets URI

Starting with version 1.1.0 all URI objects are defined in the League\Uri namespace. The League\Uri\Schemes namespace is deprecated and will be removed in the next major release.

To work with websockets URIs you can use the League\Uri\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;

$uri = Uri\Ws::createFromString('wss://thephpleague.com/path/to?here#content');
// will throw an League\Uri\UriException

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