Skip to content
PHP Ecosystem
Explore

Url

API reference › yii › helpers › Url

classyii\helpers\Url
ExtendsBaseUrl
Since2.0
Sourceframework/helpers/Url.php

Url provides a set of static methods for managing URLs.

For more details and usage information on Url, see the guide article on url helpers.

PropertyTypeDescriptionDefined by
$urlManager staticyii\web\UrlManagerURL manager to use for creating URLs Default: null. Available since 2.0.8.BaseUrl
MethodDescriptionDefined by
base() staticReturns the base URL of the current request.BaseUrl
canonical() staticReturns the canonical URL of the currently requested page.BaseUrl
current() staticCreates a URL by using the current route and the GET parameters.BaseUrl
ensureScheme() staticNormalize the URL by ensuring it uses specified scheme.BaseUrl
home() staticReturns the home URL.BaseUrl
isRelative() staticReturns a value indicating whether a URL is relative.BaseUrl
previous() staticReturns the URL previously remembered.BaseUrl
remember() staticRemembers the specified URL so that it can be later fetched back by previous().BaseUrl
to() staticCreates a URL based on the given parameters.BaseUrl
toRoute() staticCreates a URL for the given route.BaseUrl
getUrlManager() protected staticBaseUrl
normalizeRoute() protected staticNormalizes route and makes it suitable for UrlManager. Absolute routes are staying as is while relative routes are converted to absolute ones.BaseUrl
resolveCurrentRoute() protected staticResolves the route of the currently requested page.BaseUrl