Helper for returning the current server URL (optionally with request URI)

package Default
inherited_from \Zend\View\Helper\AbstractHelper

 Methods

View helper entry point: Returns the current host's URL like http://site.com

__invoke(string|boolean $requestUri = null) : string

Parameters

$requestUri

stringboolean

[optional] if true, the request URI found in $_SERVER will be appended as a path. If a string is given, it will be appended as a path. Default is to not append any path.

Returns

string

Returns host

getHost() : string

Returns

string

Retrieve the server port

getPort() : integer | null

Returns

integernull

Returns scheme (typically http or https)

getScheme() : string

Returns

string

Get the view object

getView() : null | \Zend\View\Renderer\RendererInterface
Inherited
inherited_from \Zend\View\Helper\HelperInterface::getView()

Returns

null\Zend\View\Renderer\RendererInterface

Sets host

setHost(string $host) : \Zend\View\Helper\ServerUrl

Parameters

$host

string

Returns

\Zend\View\Helper\ServerUrl

Set server port

setPort(integer $port) : \Zend\View\Helper\ServerUrl

Parameters

$port

integer

Returns

\Zend\View\Helper\ServerUrl

Sets scheme (typically http or https)

setScheme(string $scheme) : \Zend\View\Helper\ServerUrl

Parameters

$scheme

string

Returns

\Zend\View\Helper\ServerUrl

Set flag indicating whether or not to query proxy servers

setUseProxy(boolean $useProxy = false) : \Zend\View\Helper\ServerUrl

Parameters

$useProxy

boolean

Returns

\Zend\View\Helper\ServerUrl

Set the View object

setView(\Zend\View\Renderer\RendererInterface $view) : \Zend\View\Helper\AbstractHelper
Inherited
inherited_from \Zend\View\Helper\HelperInterface::setView()

Parameters

$view

\Zend\View\Renderer\RendererInterface

Returns

\Zend\View\Helper\AbstractHelper

Detect the host based on headers

detectHost() : void

Detect the port

detectPort() : null

Returns

null

Detect the scheme

detectScheme() : null

Returns

null

isReversedProxy()

isReversedProxy() 

Detect if a proxy is in use, and, if so, set the host based on it

setHostFromProxy() : boolean

Returns

boolean

Set port based on detected proxy headers

setPortFromProxy() : boolean

Returns

boolean

Set the current scheme based on detected proxy headers

setSchemeFromProxy() : boolean

Returns

boolean

 Properties

 

Host (including port)

$host : string

Default

 

Port

$port : integer

Default

 

Scheme

$scheme : string

Default

 

Whether or not to query proxy servers for address

$useProxy : boolean

Default

false
 

View object instance

$view : \Zend\View\Renderer\RendererInterface

Default

null