Documentation

Http
in package
implements UriInterface, JsonSerializable

Interfaces, Classes and Traits

UriInterface
Value object representing a URI.
JsonSerializable

Table of Contents

$uri  : UriInterface
__set_state()  : self
Static method called by PHP's var export.
__toString()  : string
Return the string representation as a URI reference.
createFromBaseUri()  : self
Create a new instance from a URI and a Base URI.
createFromComponents()  : self
Create a new instance from a hash of parse_url parts.
createFromServer()  : self
Create a new instance from the environment.
createFromString()  : self
Create a new instance from a string.
createFromUri()  : self
Create a new instance from a URI object.
getAuthority()  : string
Retrieve the authority component of the URI.
getFragment()  : string
Retrieve the fragment component of the URI.
getHost()  : string
Retrieve the host component of the URI.
getPath()  : string
Retrieve the path component of the URI.
getPort()  : null|int
Retrieve the port component of the URI.
getQuery()  : string
Retrieve the query string of the URI.
getScheme()  : string
Retrieve the scheme component of the URI.
getUserInfo()  : string
Retrieve the user information component of the URI.
jsonSerialize()  : string
{@inheritDoc}
withFragment()  : static
Return an instance with the specified URI fragment.
withHost()  : static
Return an instance with the specified host.
withPath()  : static
Return an instance with the specified path.
withPort()  : static
Return an instance with the specified port.
withQuery()  : static
Return an instance with the specified query string.
withScheme()  : static
Return an instance with the specified scheme.
withUserInfo()  : static
Return an instance with the specified user information.
__construct()  : mixed
filterInput()  : string|mixed
Safely stringify input when possible.
validate()  : void
Validate the submitted uri against PSR-7 UriInterface.

Properties

Methods

__set_state()

Static method called by PHP's var export.

public static __set_state(array<string|int, mixed> $components) : self
Parameters
$components : array<string|int, mixed>
Return values
self

__toString()

Return the string representation as a URI reference.

public __toString() : string
Return values
string

createFromBaseUri()

Create a new instance from a URI and a Base URI.

public static createFromBaseUri(mixed $uri[, mixed $base_uri = null ]) : self

The returned URI must be absolute.

Parameters
$uri : mixed

the input URI to create

$base_uri : mixed = null

the base URI used for reference

Return values
self

createFromComponents()

Create a new instance from a hash of parse_url parts.

public static createFromComponents(array<string|int, mixed> $components) : self
Parameters
$components : array<string|int, mixed>

a hash representation of the URI similar to PHP parse_url function result

Return values
self

createFromServer()

Create a new instance from the environment.

public static createFromServer(array<string|int, mixed> $server) : self
Parameters
$server : array<string|int, mixed>
Return values
self

createFromString()

Create a new instance from a string.

public static createFromString([string|mixed $uri = '' ]) : self
Parameters
$uri : string|mixed = ''
Return values
self

getAuthority()

Retrieve the authority component of the URI.

public getAuthority() : string
Return values
string

The URI authority, in "[user-info@]host[:port]" format.

getFragment()

Retrieve the fragment component of the URI.

public getFragment() : string
Return values
string

The URI fragment.

getHost()

Retrieve the host component of the URI.

public getHost() : string
Return values
string

The URI host.

getPath()

Retrieve the path component of the URI.

public getPath() : string
Return values
string

The URI path.

getPort()

Retrieve the port component of the URI.

public getPort() : null|int
Return values
null|int

The URI port.

getQuery()

Retrieve the query string of the URI.

public getQuery() : string
Return values
string

The URI query string.

getScheme()

Retrieve the scheme component of the URI.

public getScheme() : string
Return values
string

The URI scheme.

getUserInfo()

Retrieve the user information component of the URI.

public getUserInfo() : string
Return values
string

The URI user information, in "username[:password]" format.

jsonSerialize()

{@inheritDoc}

public jsonSerialize() : string
Return values
string

withFragment()

Return an instance with the specified URI fragment.

public withFragment(mixed $fragment) : static
Parameters
$fragment : mixed

The fragment to use with the new instance.

Return values
static

A new instance with the specified fragment.

withHost()

Return an instance with the specified host.

public withHost(mixed $host) : static
Parameters
$host : mixed

The hostname to use with the new instance.

Return values
static

A new instance with the specified host.

withPath()

Return an instance with the specified path.

public withPath(mixed $path) : static
Parameters
$path : mixed

The path to use with the new instance.

Return values
static

A new instance with the specified path.

withPort()

Return an instance with the specified port.

public withPort(mixed $port) : static
Parameters
$port : mixed

The port to use with the new instance; a null value removes the port information.

Return values
static

A new instance with the specified port.

withQuery()

Return an instance with the specified query string.

public withQuery(mixed $query) : static
Parameters
$query : mixed

The query string to use with the new instance.

Return values
static

A new instance with the specified query string.

withScheme()

Return an instance with the specified scheme.

public withScheme(mixed $scheme) : static
Parameters
$scheme : mixed

The scheme to use with the new instance.

Return values
static

A new instance with the specified scheme.

withUserInfo()

Return an instance with the specified user information.

public withUserInfo(mixed $user[, mixed $password = null ]) : static
Parameters
$user : mixed

The user name to use for authority.

$password : mixed = null

The password associated with $user.

Return values
static

A new instance with the specified user information.

filterInput()

Safely stringify input when possible.

private filterInput(mixed $str) : string|mixed
Parameters
$str : mixed

the value to evaluate as a string

Tags
throws
SyntaxError

if the submitted data can not be converted to string

Return values
string|mixed

validate()

Validate the submitted uri against PSR-7 UriInterface.

private validate(UriInterface $uri) : void
Parameters
$uri : UriInterface
Tags
throws
SyntaxError

if the given URI does not follow PSR-7 UriInterface rules

Return values
void

Search results