Uri
in package
HTTP URI class
Tags
Table of Contents
Properties
- $basePath : string|null
- Base path
- $fragment : string|null
- Fragment
- $host : string|null
- Host
- $password : string|null
- Password
- $port : string|int|null
- Port
- $query : string|null
- Query
- $scheme : string|null
- Scheme
- $segments : array<string|int, mixed>
- Path segments
- $uri : string|null
- URI
- $username : string|null
- Username
Methods
- __construct() : mixed
- Constructor
- __toString() : string
- Render the URI
- create() : Uri
- Create URI object
- getBasePath() : string
- Get the base path
- getFragment() : string
- Get the fragment
- getFullHost() : string
- Get the host with the port
- getFullUri() : string
- Get the full URI, including base path
- getHost() : string
- Get the host
- getPassword() : string
- Get the password
- getPort() : string|int|null
- Get the port
- getQuery() : string
- Get the query
- getQueryAsArray() : array<string|int, mixed>
- Get the query
- getScheme() : string
- Get the scheme
- getSegment() : string|null
- Get a path segment, divided by the forward slash, where $i refers to the array key index, i.e., 0 1 2 /hello/world/page
- getSegments() : array<string|int, mixed>
- Get all path segments
- getUri() : string
- Get the URI
- getUsername() : string
- Get the username
- hasBasePath() : bool
- Has a base path
- hasFragment() : bool
- Has a fragment
- hasHost() : bool
- Has a host
- hasPassword() : bool
- Has a password
- hasPort() : bool
- Has a port
- hasQuery() : bool
- Has a query
- hasScheme() : bool
- Has a scheme
- hasSegment() : bool
- Has segment
- hasSegments() : bool
- Has segments
- hasUri() : bool
- Has a uri
- hasUsername() : bool
- Has a username
- render() : string
- Render the URI
- setBasePath() : Uri
- Set the base path
- setFragment() : Uri
- Set the fragment
- setHost() : Uri
- Set the host
- setPassword() : Uri
- Set the password
- setPort() : Uri
- Set the port
- setQuery() : Uri
- Set the query
- setScheme() : Uri
- Set the scheme
- setUri() : Uri
- Set the URI
- setUsername() : Uri
- Set the username
Properties
$basePath
Base path
protected
string|null
$basePath
= null
$fragment
Fragment
protected
string|null
$fragment
= null
$host
Host
protected
string|null
$host
= null
$password
Password
protected
string|null
$password
= null
$port
Port
protected
string|int|null
$port
= null
$query
Query
protected
string|null
$query
= null
$scheme
Scheme
protected
string|null
$scheme
= null
$segments
Path segments
protected
array<string|int, mixed>
$segments
= []
$uri
URI
protected
string|null
$uri
= null
$username
Username
protected
string|null
$username
= null
Methods
__construct()
Constructor
public
__construct([string|null $uri = null ][, string|null $basePath = null ]) : mixed
Instantiate the URI object
Parameters
- $uri : string|null = null
- $basePath : string|null = null
Tags
__toString()
Render the URI
public
__toString() : string
Return values
stringcreate()
Create URI object
public
static create([string|null $uri = null ][, string|null $basePath = null ]) : Uri
Parameters
- $uri : string|null = null
- $basePath : string|null = null
Tags
Return values
UrigetBasePath()
Get the base path
public
getBasePath() : string
Return values
stringgetFragment()
Get the fragment
public
getFragment() : string
Return values
stringgetFullHost()
Get the host with the port
public
getFullHost() : string
Return values
stringgetFullUri()
Get the full URI, including base path
public
getFullUri() : string
Return values
stringgetHost()
Get the host
public
getHost() : string
Return values
stringgetPassword()
Get the password
public
getPassword() : string
Return values
stringgetPort()
Get the port
public
getPort() : string|int|null
Return values
string|int|nullgetQuery()
Get the query
public
getQuery() : string
Return values
stringgetQueryAsArray()
Get the query
public
getQueryAsArray() : array<string|int, mixed>
Return values
array<string|int, mixed>getScheme()
Get the scheme
public
getScheme() : string
Return values
stringgetSegment()
Get a path segment, divided by the forward slash, where $i refers to the array key index, i.e., 0 1 2 /hello/world/page
public
getSegment(int $i) : string|null
Parameters
- $i : int
Return values
string|nullgetSegments()
Get all path segments
public
getSegments() : array<string|int, mixed>
Return values
array<string|int, mixed>getUri()
Get the URI
public
getUri() : string
Return values
stringgetUsername()
Get the username
public
getUsername() : string
Return values
stringhasBasePath()
Has a base path
public
hasBasePath() : bool
Return values
boolhasFragment()
Has a fragment
public
hasFragment() : bool
Return values
boolhasHost()
Has a host
public
hasHost() : bool
Return values
boolhasPassword()
Has a password
public
hasPassword() : bool
Return values
boolhasPort()
Has a port
public
hasPort() : bool
Return values
boolhasQuery()
Has a query
public
hasQuery() : bool
Return values
boolhasScheme()
Has a scheme
public
hasScheme() : bool
Return values
boolhasSegment()
Has segment
public
hasSegment(mixed $i) : bool
Parameters
- $i : mixed
Return values
boolhasSegments()
Has segments
public
hasSegments() : bool
Return values
boolhasUri()
Has a uri
public
hasUri() : bool
Return values
boolhasUsername()
Has a username
public
hasUsername() : bool
Return values
boolrender()
Render the URI
public
render() : string
Return values
stringsetBasePath()
Set the base path
public
setBasePath([string|null $path = null ]) : Uri
Parameters
- $path : string|null = null
Return values
UrisetFragment()
Set the fragment
public
setFragment(string $fragment) : Uri
Parameters
- $fragment : string
Return values
UrisetHost()
Set the host
public
setHost(string $host) : Uri
Parameters
- $host : string
Return values
UrisetPassword()
Set the password
public
setPassword(string $password) : Uri
Parameters
- $password : string
Return values
UrisetPort()
Set the port
public
setPort(string|int $port) : Uri
Parameters
- $port : string|int
Return values
UrisetQuery()
Set the query
public
setQuery(string|array<string|int, mixed> $query) : Uri
Parameters
- $query : string|array<string|int, mixed>
Return values
UrisetScheme()
Set the scheme
public
setScheme(string $scheme) : Uri
Parameters
- $scheme : string
Return values
UrisetUri()
Set the URI
public
setUri([string|null $uri = null ][, string|null $basePath = null ]) : Uri
Parameters
- $uri : string|null = null
- $basePath : string|null = null
Return values
UrisetUsername()
Set the username
public
setUsername(string $username) : Uri
Parameters
- $username : string