public function generateServerUrl($path = null) { if (!$this->serverUrlHelper) { $this->serverUrlHelper = $this->container->get(ServerUrlHelper::class); } return $this->serverUrlHelper->generate($path); }
/** * Generate a fully qualified URI, relative to $path. * * @param null|string $path * @return string */ public function generateServerUrl($path = null) { return $this->serverUrlHelper->generate($path); }
/** * Inject the ServerUrlHelper instance with the request URI. * * Injects the ServerUrlHelper with the incoming request URI, and then invoke * the next middleware. * * @param ServerRequestInterface $request * @param ResponseInterface $response * @param callable $next * @return ResponseInterface */ public function __invoke(ServerRequestInterface $request, ResponseInterface $response, callable $next) { $this->helper->setUri($request->getUri()); return $next($request, $response); }
/** * Proxies to `Zend\Expressive\Helper\ServerUrlHelper::setUri()` * @param UriInterface $uri */ public function setUri(UriInterface $uri) { $this->helper->setUri($uri); }
/** * Render absolute url from a path * * Usage: {{ absolute_url('path/to/something') }} * Generates: http://example.com/path/to/something * * @param $path * * @return string */ public function renderUrlFromPath($path = null) { return $this->serverUrlHelper->generate($path); }