Zend\View\Helper\ServerUrl
Helper for returning the current server URL (optionally with request URI)
Synopsis
class ServerUrl
extends AbstractHelper
{
- // members
- protected string $host;
- protected int $port;
- protected string $scheme;
- protected bool $useProxy;
- // Inherited members from AbstractHelper
- protected RendererInterface $view;
- // methods
- public string __invoke()
- protected void detectHost()
- protected null detectPort()
- protected null detectScheme()
- protected bool setHostFromProxy()
- protected bool setPortFromProxy()
- protected bool setSchemeFromProxy()
- public ServerUrl setHost()
- public string getHost()
- public ServerUrl setPort()
- public int|null getPort()
- public ServerUrl setScheme()
- public string getScheme()
- public ServerUrl setUseProxy()
- // Inherited methods from AbstractHelper
- public AbstractHelper setView()
- public null|Renderer getView()
Hierarchy
Extends
Members
protected
- $host
—
string
Host (including port) - $port
—
int
Port - $scheme
—
string
Scheme - $useProxy
—
Zend\View\Helper\bool
Whether or not to query proxy servers for address - $view
—
Zend\View\Renderer\RendererInterface
View object instance
Methods
protected
- detectHost() — Detect the host based on headers
- detectPort() — Detect the port
- detectScheme() — Detect the scheme
- setHostFromProxy() — Detect if a proxy is in use, and, if so, set the host based on it
- setPortFromProxy() — Set port based on detected proxy headers
- setSchemeFromProxy() — Set the current scheme based on detected proxy headers
public
- __invoke() — View helper entry point: Returns the current host's URL like http://site.com
- getHost() — Returns host
- getPort() — Retrieve the server port
- getScheme() — Returns scheme (typically http or https)
- setHost() — Sets host
- setPort() — Set server port
- setScheme() — Sets scheme (typically http or https)
- setUseProxy() — Set flag indicating whether or not to query proxy servers