Oihana PHP Enums

UriScheme uses ConstantsTrait

Enumeration of common URI schemes (the part before `://`).

Values are lowercased — the canonical form returned by PHP's parse_url() and recommended by RFC 3986 §3.1 (schemes are case-insensitive but conventionally written lowercase).

Tags
author

Marc Alcaraz

see
UrlComponent

Table of Contents

Constants

FTP  : string = 'ftp'
File Transfer Protocol. Default port `21`.
HTTP  : string = 'http'
HyperText Transfer Protocol (cleartext). Default port `80`.
HTTPS  : string = 'https'
HTTP over TLS. Default port `443`.
WS  : string = 'ws'
WebSocket (cleartext). Default port `80`.
WSS  : string = 'wss'
WebSocket over TLS. Default port `443`.

Methods

defaultPort()  : int|null
Returns the default TCP port for a scheme, or `null` when the scheme has no well-known default.

Constants

FTP

File Transfer Protocol. Default port `21`.

public string FTP = 'ftp'

HTTP

HyperText Transfer Protocol (cleartext). Default port `80`.

public string HTTP = 'http'

HTTPS

HTTP over TLS. Default port `443`.

public string HTTPS = 'https'

WS

WebSocket (cleartext). Default port `80`.

public string WS = 'ws'

WSS

WebSocket over TLS. Default port `443`.

public string WSS = 'wss'

Methods

defaultPort()

Returns the default TCP port for a scheme, or `null` when the scheme has no well-known default.

public static defaultPort(string $scheme) : int|null

Lets callers drop a redundant port when canonicalising a URL (https://host:443/https://host/).

Parameters
$scheme : string

One of the class constants (case-insensitive).

Return values
int|null

The default port, or null if unknown.

On this page

Search results