URL
in package
implements
JsonSerializable
This dynamically generates system urls this allows us to validate URLs if needed or generate different types of them depending on if pretty links is enabled
Tags
Interfaces, Classes and Traits
- JsonSerializable
Table of Contents
- $absolute : bool
- $params : mixed|array<string|int, Get>
- $path : Path
- __construct() : mixed
- __toString() : mixed
- absolute() : URL
- appendParameter() : mixed
- canonical() : mixed
- current() : mixed
- getExtension() : mixed
- getParameter() : mixed
- Returns the value of a parameter set in the current URL.
- getPath() : mixed
- getRoutes() : mixed
- hostname() : string
- jsonSerialize() : string
- Returns the string representation of the URL. This is because the URL object does contain additional data that will generally cause unexpected behavior when rendering a URL.
- make() : mixed
- setExtension() : mixed
- setParam() : self
- Sets a parameter for the URL's GET
- setParams() : mixed
- setPath() : mixed
- stringify() : mixed
- Serializes the URL. This method ill check if a custom serializer was defined and will then use the appropriate serializer OR fall back to the default one.
Properties
$absolute
private
bool
$absolute
= false
Indicates whether the URL should be prefixed with the application's hostname. This hostname will be retrieved from the application configuration if available (otherwise the system will attempt to guess it or throw an exception)
$params
private
mixed|array<string|int, Get>
$params
= array()
Contains data about the _GET parameters this URL will pass to the system if invoked by the user.
$path
private
Path
$path
Contains information about the controller / action / object combination that will be used for this URL.
Methods
__construct()
public
__construct([mixed $controller = null ][, mixed $action = null ][, mixed $object = null ][, mixed $extension = null ][, mixed $get = null ][, mixed $environment = null ]) : mixed
Parameters
- $controller : mixed = null
- $action : mixed = null
- $object : mixed = null
- $extension : mixed = null
- $get : mixed = null
- $environment : mixed = null
Return values
mixed —__toString()
public
__toString() : mixed
Return values
mixed —absolute()
public
absolute([bool $set = true ]) : URL
Parameters
- $set : bool = true
Return values
URL —appendParameter()
public
appendParameter(mixed $param, mixed $value) : mixed
Parameters
- $param : mixed
- $value : mixed
Return values
mixed —canonical()
public
static canonical() : mixed
Return values
mixed —current()
public
static current() : mixed
Return values
mixed —getExtension()
public
getExtension() : mixed
Return values
mixed —getParameter()
Returns the value of a parameter set in the current URL.
public
getParameter(string $parameter) : mixed
Parameters
- $parameter : string
Return values
mixed —getPath()
public
getPath() : mixed
Return values
mixed —getRoutes()
public
getRoutes() : mixed
Return values
mixed —hostname()
public
hostname() : string
Return values
string —jsonSerialize()
Returns the string representation of the URL. This is because the URL object does contain additional data that will generally cause unexpected behavior when rendering a URL.
public
jsonSerialize() : string
One would not expect that json_encode(['url' => new URL()]) would lead to a complex object, but instead to {url: '/'}
Return values
string —make()
public
static make(mixed $url) : mixed
Parameters
- $url : mixed
Return values
mixed —setExtension()
public
setExtension(mixed $extension) : mixed
Parameters
- $extension : mixed
Return values
mixed —setParam()
Sets a parameter for the URL's GET
public
setParam(string $param, string $value) : self
Parameters
- $param : string
- $value : string
-
[NOTICE] This function accepts parameters like controller, action or object that are part of the specification of nlive's core. It is highly recommended not to use this "reserved words" as parameters as they may cause the real values of these to be overwritten when the browser requests the site linked by these.
Return values
self —setParams()
public
setParams(mixed $values) : mixed
Parameters
- $values : mixed
Return values
mixed —setPath()
public
setPath(mixed $path) : mixed
Parameters
- $path : mixed
Return values
mixed —stringify()
Serializes the URL. This method ill check if a custom serializer was defined and will then use the appropriate serializer OR fall back to the default one.
public
stringify() : mixed