class UrlPackage extends Package

deprecated since 2.7, will be removed in 3.0. Use the Asset component instead.

The URL packages adds a version and a base URL to asset URLs.

Methods

__construct(string|array $baseUrls = array(), string $version = null, string $format = null)

Constructor.

string
getVersion()

Returns the asset package version.

from Package
string
getUrl(string $path, string|bool|null $version = null)

Returns an absolute or root-relative public path.

string
getBaseUrl(string $path)

Returns the base URL for a path.

Details

at line line 34
__construct(string|array $baseUrls = array(), string $version = null, string $format = null)

Constructor.

Parameters

string|array $baseUrls Base asset URLs
string $version The package version
string $format The format used to apply the version

in Package at line line 43
string getVersion()

Returns the asset package version.

Return Value

string The version string

at line line 51
string getUrl(string $path, string|bool|null $version = null)

Returns an absolute or root-relative public path.

Parameters

string $path A path
string|bool|null $version A specific version for the path

Return Value

string The public path

at line line 73
string getBaseUrl(string $path)

Returns the base URL for a path.

Parameters

string $path

Return Value

string The base URL