class BaseUriProvider (View source)

Supports to get a baseUri from various possible sources.

Properties

protected string|null $configuredBaseUri

THe possibly configured Flow base URI.

protected Bootstrap $bootstrap

Methods

UriInterface
getConfiguredBaseUriOrFallbackToCurrentRequest(ServerRequestInterface $fallbackRequest = null)

Gives the best possible base URI with the following priority:

  • configured base URI
  • generated base URI from currently active server request
  • generated base URI from specified $fallbackRequest

Details

UriInterface getConfiguredBaseUriOrFallbackToCurrentRequest(ServerRequestInterface $fallbackRequest = null)

Gives the best possible base URI with the following priority:

  • configured base URI
  • generated base URI from currently active server request
  • generated base URI from specified $fallbackRequest

To ensure a base URI can always be provided this will throw an exception if none of the options yields a result.

Parameters

ServerRequestInterface $fallbackRequest

HTTP request to be used if no base Uri is configured and the currently active request can't be determined (e.g. in CLI context)

Return Value

UriInterface

Exceptions

Exception