Documentation

Uri extends AbstractUri
in package

Implements PSR-7 UriInterface.

Table of Contents

Properties

$defaultPorts  : array<string|int, mixed>
$queryParams  : array<string|int, mixed>

Methods

__construct()  : void
You can use `UriFactory` functions to create new `Uri` objects.
__toString()  : string
getAuthority()  : mixed
getBaseUrl()  : string
Return the fully qualified base URL ( like http://getgrav.org ).
getFragment()  : mixed
getHost()  : mixed
getParts()  : array<string|int, mixed>
getPassword()  : string
getPath()  : mixed
getPort()  : mixed
getQuery()  : mixed
getQueryParam()  : string|null
getQueryParams()  : array<string|int, mixed>
getScheme()  : mixed
getUrl()  : string
getUser()  : string
getUserInfo()  : mixed
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()  : mixed
withHost()  : mixed
withoutQueryParam()  : UriInterface
withPath()  : mixed
withPort()  : mixed
withQuery()  : mixed
withQueryParam()  : UriInterface
withQueryParams()  : UriInterface
withScheme()  : mixed
withUserInfo()  : mixed
initParts()  : void

Properties

$defaultPorts

protected static array<string|int, mixed> $defaultPorts = ['http' => 80, 'https' => 443]

$queryParams

private array<string|int, mixed> $queryParams

Array of Uri query.

Methods

__construct()

You can use `UriFactory` functions to create new `Uri` objects.

public __construct([array<string|int, mixed> $parts = [] ]) : void
Parameters
$parts : array<string|int, mixed> = []
Tags
throws
InvalidArgumentException

__toString()

public __toString() : string
Attributes
#[ReturnTypeWillChange]
Return values
string

getAuthority()

public getAuthority() : mixed
Tags
inheritdoc

getBaseUrl()

Return the fully qualified base URL ( like http://getgrav.org ).

public getBaseUrl() : string
Return values
string

getFragment()

public getFragment() : mixed
Tags
inheritdoc

getParts()

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

getPassword()

public getPassword() : string
Return values
string

getQuery()

public getQuery() : mixed
Tags
inheritdoc

getQueryParam()

public getQueryParam(string $key) : string|null
Parameters
$key : string
Return values
string|null

getQueryParams()

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

getScheme()

public getScheme() : mixed
Tags
inheritdoc

getUrl()

public getUrl() : string
Return values
string

getUser()

public getUser() : string
Return values
string

getUserInfo()

public getUserInfo() : mixed
Tags
inheritdoc

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(mixed $fragment) : mixed
Parameters
$fragment : mixed
Tags
inheritdoc
throws
InvalidArgumentException

withHost()

public withHost(mixed $host) : mixed
Parameters
$host : mixed
Tags
inheritdoc

withoutQueryParam()

public withoutQueryParam(string $key) : UriInterface
Parameters
$key : string
Return values
UriInterface

withPath()

public withPath(mixed $path) : mixed
Parameters
$path : mixed
Tags
inheritdoc

withPort()

public withPort(mixed $port) : mixed
Parameters
$port : mixed
Tags
inheritdoc

withQuery()

public withQuery(mixed $query) : mixed
Parameters
$query : mixed
Tags
inheritdoc

withQueryParam()

public withQueryParam(string $key, string|null $value) : UriInterface
Parameters
$key : string
$value : string|null
Return values
UriInterface

withQueryParams()

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

withScheme()

public withScheme(mixed $scheme) : mixed
Parameters
$scheme : mixed
Tags
inheritdoc

withUserInfo()

public withUserInfo(mixed $user[, mixed $password = null ]) : mixed
Parameters
$user : mixed
$password : mixed = null
Tags
inheritdoc
throws
InvalidArgumentException

initParts()

protected initParts(array<string|int, mixed> $parts) : void
Parameters
$parts : array<string|int, mixed>
Tags
throws
InvalidArgumentException

        
On this page

Search results