Url
- Full name:
\Qubus\Http\Url
- Parent class:
Uri
- This class implements:
\Psr\Http\Message\UriInterface
,\JsonSerializable
Properties
originalUrl
scheme
username
password
host
port
path
originalPath
Original path with no sanitization to ending slash.
params
fragment
Methods
__construct
Parameters:
Parameter | Type | Description |
---|---|---|
$uri | string |
Throws:
parse
Parameters:
Parameter | Type | Description |
---|---|---|
$url | ?string | |
$originalPath | bool |
Throws:
isSecure
Check if url is using a secure protocol like https.
isRelative
Checks if url is relative.
withUsername
Set the username of the url
Parameters:
Parameter | Type | Description |
---|---|---|
$username | string |
withPassword
Set the url password
Parameters:
Parameter | Type | Description |
---|---|---|
$password | string |
withPath
Set the url path
Parameters:
Parameter | Type | Description |
---|---|---|
$path | string |
mergeParams
Merge parameters array
Parameters:
Parameter | Type | Description |
---|---|---|
$params | array |
withParams
Set the url params
Parameters:
Parameter | Type | Description |
---|---|---|
$params | array |
withQueryString
Set raw query-string parameters as string
Parameters:
Parameter | Type | Description |
---|---|---|
$queryString | string |
getQueryString
Get query-string params as string
getFragment
Get fragment from url (everything after #)
indexOf
Get position of value.
Returns -1 on failure.
Parameters:
Parameter | Type | Description |
---|---|---|
$value | string |
contains
Check if url contains value.
Parameters:
Parameter | Type | Description |
---|---|---|
$value | string |
hasParam
Check if url contains parameter/query string.
Parameters:
Parameter | Type | Description |
---|---|---|
$name | string |
removeParams
Removes multiple parameters from the query-string
Parameters:
Parameter | Type | Description |
---|---|---|
$names | int[]|string[] |
removeParam
Removes parameter from the query-string
Parameters:
Parameter | Type | Description |
---|---|---|
$name | string |
getParam
Get parameter by name.
Returns parameter value or default value.
Parameters:
Parameter | Type | Description |
---|---|---|
$name | string | |
$defaultValue | ?string |
parseUrl
UTF-8 aware parse_url() replacement.
Parameters:
Parameter | Type | Description |
---|---|---|
$url | string | |
$component | int |
Throws:
arrayToParams
Convert array to query-string params.
- This method is static.
Parameters:
Parameter | Type | Description |
---|---|---|
$getParams | array | |
$includeEmpty | bool |
getRelativeUrl
Returns the relative url
Parameters:
Parameter | Type | Description |
---|---|---|
$includeParams | bool |
getAbsoluteUrl
Returns the absolute url
Parameters:
Parameter | Type | Description |
---|---|---|
$includeParams | bool |
jsonSerialize
Specify data which should be serialized to JSON.
Return Value:
Data which can be serialized by json_encode, which is a value of any type other than a resource.
See Also:
- http://php.net/manual/en/jsonserializable.jsonserialize.php -
__toString
Automatically generated on 2025-10-13