class Url
URL common methods
For convenience, the best practice is to use:
use Library\Helper\Url as UrlHelper;
Methods
static string |
getRequestUrl(bool $entities = false, bool $base = false, bool $no_file = false, bool $no_rewrite = false)
Get the current browser/server URL |
|
static string |
getHttpProtocol()
Get the current 'http' or 'https' protocol |
|
static array |
parse(string $url)
Parse an URL and returns its composition as an array, with the URI query if so |
|
static string |
resolvePath(string $url = null, boolean $realpath = false)
Returns the URL with paths cleaned ( |
|
static string |
resolveHttp(string $url = null)
Returns an URL with leading 'http://' if it was absent Inspired by SPIP http://spip.net |
|
static string |
getAbsoluteUrl(string $url = null)
Returns if possible an absolute URL in the current system |
|
static string |
url(string/array/null $param = null, string/null $value = null, string/null $url = null)
Global URL builder |
|
static string/array |
getParameter(string/bool $param = false, string/null $url = false)
Get the value of an URL parameter |
|
static string/array |
setParameter(string/bool $var = '', string/false $val = false, string/false $url = false, bool $rebuild = true)
Set the value of an URL parameter |
|
static string |
build(array $url_components = null, string/array/boolean $not_toput = null)
Rebuild a full URL string from an array of elements |
|
static bool |
isUrl(string $url = null, array $protocols = array('http', 'https', 'ftp'), bool/string $localhost = false)
Validate an URL (without a hash content) |
|
static bool |
isEmail(string $email = null)
Validate an email address |
Details
at line 48
static public string
getRequestUrl(bool $entities = false, bool $base = false, bool $no_file = false, bool $no_rewrite = false)
Get the current browser/server URL
at line 89
static public string
getHttpProtocol()
Get the current 'http' or 'https' protocol
at line 103
static public array
parse(string $url)
Parse an URL and returns its composition as an array, with the URI query if so
at line 124
static public string
resolvePath(string $url = null, boolean $realpath = false)
Returns the URL with paths cleaned (./
and ../
are resolved)
Inspired by SPIP http://spip.net
at line 151
static public string
resolveHttp(string $url = null)
Returns an URL with leading 'http://' if it was absent Inspired by SPIP http://spip.net
at line 169
static public string
getAbsoluteUrl(string $url = null)
Returns if possible an absolute URL in the current system
at line 191
static public string
url(string/array/null $param = null, string/null $value = null, string/null $url = null)
Global URL builder
at line 226
static public string/array
getParameter(string/bool $param = false, string/null $url = false)
Get the value of an URL parameter
at line 259
static public string/array
setParameter(string/bool $var = '', string/false $val = false, string/false $url = false, bool $rebuild = true)
Set the value of an URL parameter
at line 281
static public string
build(array $url_components = null, string/array/boolean $not_toput = null)
Rebuild a full URL string from an array of elements
at line 314
static public bool
isUrl(string $url = null, array $protocols = array('http', 'https', 'ftp'), bool/string $localhost = false)
Validate an URL (without a hash content)
at line 336
static public bool
isEmail(string $email = null)
Validate an email address