Websockets URI
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.
<?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.