Returns an (current) URL's components as an array.

Internally it uses the PHP's function: parse_url()

Syntax

urlInfo(string $url = null): array


Parameter

@param string $url The complete or partial url. If NULL the currently called (rendered) url is used.


Return

Returns an array containing the keys (only set if their parts were present in the $url):

  • scheme - string
  • host - string
  • port - string|number
  • user - string
  • pass - string
  • path - string
  • params - array The query-string, everything after the question mark "?", parsed into an (multi-dimensional) array.
  • fragment - string Everything after the anchor-hash "#"


Examples

To get all components of the currently rendered and called url:

{% set uI = hublify.urlInfo() %}

gives you for example (hublify.dump'ed):

<yet, to come....>