Documentation

Uri
in package
implements UriInterface uses UriDecorationTrait

Class Uri

Table of Contents

Interfaces

UriInterface

Properties

$uri  : UriInterface

Methods

__construct()  : mixed
__toString()  : string
getAuthority()  : string
getFragment()  : string
getHost()  : string
getPath()  : string
getPort()  : int|null
getQuery()  : string
getQueryParams()  : array<string|int, mixed>
getScheme()  : string
getUserInfo()  : string
isAbsolute()  : bool
Whether the URI is absolute, i.e. it has a scheme.
isAbsolutePathReference()  : bool
Whether the URI is a absolute-path reference.
isDefaultPort()  : bool
Whether the URI has the default port of the current scheme.
isNetworkPathReference()  : bool
Whether the URI is a network-path reference.
isRelativePathReference()  : bool
Whether the URI is a relative-path reference.
isSameDocumentReference()  : bool
Whether the URI is a same-document reference.
withFragment()  : UriInterface
withHost()  : UriInterface
withPath()  : UriInterface
withPort()  : UriInterface
withQuery()  : UriInterface
withQueryParams()  : UriInterface
withScheme()  : UriInterface
withUserInfo()  : UriInterface

Properties

Methods

__construct()

public __construct([string $uri = '' ]) : mixed
Parameters
$uri : string = ''

getQueryParams()

public getQueryParams() : array<string|int, mixed>
Return values
array<string|int, mixed>

isAbsolute()

Whether the URI is absolute, i.e. it has a scheme.

public isAbsolute() : bool

An instance of UriInterface can either be an absolute URI or a relative reference. This method returns true if it is the former. An absolute URI has a scheme. A relative reference is used to express a URI relative to another URI, the base URI. Relative references can be divided into several forms:

  • network-path references, e.g. '//example.com/path'
  • absolute-path references, e.g. '/path'
  • relative-path references, e.g. 'subpath'
Tags
link
https://tools.ietf.org/html/rfc3986#section-4
Return values
bool

isAbsolutePathReference()

Whether the URI is a absolute-path reference.

public isAbsolutePathReference() : bool

A relative reference that begins with a single slash character is termed an absolute-path reference.

Tags
link
https://tools.ietf.org/html/rfc3986#section-4.2
Return values
bool

isDefaultPort()

Whether the URI has the default port of the current scheme.

public isDefaultPort() : bool

$uri->getPort() may return the standard port. This method can be used for some non-http/https Uri.

Return values
bool

isNetworkPathReference()

Whether the URI is a network-path reference.

public isNetworkPathReference() : bool

A relative reference that begins with two slash characters is termed an network-path reference.

Tags
link
https://tools.ietf.org/html/rfc3986#section-4.2
Return values
bool

isRelativePathReference()

Whether the URI is a relative-path reference.

public isRelativePathReference() : bool

A relative reference that does not begin with a slash character is termed a relative-path reference.

Tags
link
https://tools.ietf.org/html/rfc3986#section-4.2
Return values
bool

isSameDocumentReference()

Whether the URI is a same-document reference.

public isSameDocumentReference([UriInterface|null $base = null ]) : bool

A same-document reference refers to a URI that is, aside from its fragment component, identical to the base URI. When no base URI is given, only an empty URI reference (apart from its fragment) is considered a same-document reference.

Parameters
$base : UriInterface|null = null

An optional base URI to compare against

Tags
link
https://tools.ietf.org/html/rfc3986#section-4.4
Return values
bool

withFragment()

public withFragment(string $fragment) : UriInterface
Parameters
$fragment : string
Return values
UriInterface

withHost()

public withHost(string $host) : UriInterface
Parameters
$host : string
Return values
UriInterface

withPath()

public withPath(string $path) : UriInterface
Parameters
$path : string
Return values
UriInterface

withPort()

public withPort(int|null $port) : UriInterface
Parameters
$port : int|null
Return values
UriInterface

withQuery()

public withQuery(string $query) : UriInterface
Parameters
$query : string
Return values
UriInterface

withQueryParams()

public withQueryParams(array<string|int, mixed> $params) : UriInterface
Parameters
$params : array<string|int, mixed>
Return values
UriInterface

withScheme()

public withScheme(string $scheme) : UriInterface
Parameters
$scheme : string
Return values
UriInterface

withUserInfo()

public withUserInfo(string $user[, string|null $password = null ]) : UriInterface
Parameters
$user : string
$password : string|null = null
Return values
UriInterface

        
On this page

Search results