Documentation

Uri
in package

HTTP URI class

Tags
category

Pop

author

Nick Sagona, III dev@nolainteractive.com

copyright

Copyright (c) 2009-2024 NOLA Interactive, LLC. (http://www.nolainteractive.com)

license

http://www.popphp.org/license New BSD License

version
5.2.0

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
throws
Exception

__toString()

Render the URI

public __toString() : string
Return values
string

create()

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
throws
Exception
Return values
Uri

getBasePath()

Get the base path

public getBasePath() : string
Return values
string

getFragment()

Get the fragment

public getFragment() : string
Return values
string

getFullHost()

Get the host with the port

public getFullHost() : string
Return values
string

getFullUri()

Get the full URI, including base path

public getFullUri() : string
Return values
string

getHost()

Get the host

public getHost() : string
Return values
string

getPassword()

Get the password

public getPassword() : string
Return values
string

getPort()

Get the port

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

getQuery()

Get the query

public getQuery() : string
Return values
string

getQueryAsArray()

Get the query

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

getScheme()

Get the scheme

public getScheme() : string
Return values
string

getSegment()

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|null

getSegments()

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
string

getUsername()

Get the username

public getUsername() : string
Return values
string

hasBasePath()

Has a base path

public hasBasePath() : bool
Return values
bool

hasFragment()

Has a fragment

public hasFragment() : bool
Return values
bool

hasHost()

Has a host

public hasHost() : bool
Return values
bool

hasPassword()

Has a password

public hasPassword() : bool
Return values
bool

hasPort()

Has a port

public hasPort() : bool
Return values
bool

hasQuery()

Has a query

public hasQuery() : bool
Return values
bool

hasScheme()

Has a scheme

public hasScheme() : bool
Return values
bool

hasSegment()

Has segment

public hasSegment(mixed $i) : bool
Parameters
$i : mixed
Return values
bool

hasSegments()

Has segments

public hasSegments() : bool
Return values
bool

hasUri()

Has a uri

public hasUri() : bool
Return values
bool

hasUsername()

Has a username

public hasUsername() : bool
Return values
bool

render()

Render the URI

public render() : string
Return values
string

setBasePath()

Set the base path

public setBasePath([string|null $path = null ]) : Uri
Parameters
$path : string|null = null
Return values
Uri

setFragment()

Set the fragment

public setFragment(string $fragment) : Uri
Parameters
$fragment : string
Return values
Uri

setHost()

Set the host

public setHost(string $host) : Uri
Parameters
$host : string
Return values
Uri

setPassword()

Set the password

public setPassword(string $password) : Uri
Parameters
$password : string
Return values
Uri

setPort()

Set the port

public setPort(string|int $port) : Uri
Parameters
$port : string|int
Return values
Uri

setQuery()

Set the query

public setQuery(string|array<string|int, mixed> $query) : Uri
Parameters
$query : string|array<string|int, mixed>
Return values
Uri

setScheme()

Set the scheme

public setScheme(string $scheme) : Uri
Parameters
$scheme : string
Return values
Uri

setUri()

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
Uri

setUsername()

Set the username

public setUsername(string $username) : Uri
Parameters
$username : string
Return values
Uri

        
On this page

Search results