class PathPackage extends Package

Package that adds a base path to asset URLs in addition to a version.

In addition to the provided base path, this package also automatically prepends the current request base path if a Context is available to allow a website to be hosted easily under any given path under the Web Server root directory.

Methods

__construct($basePath, VersionStrategyInterface $versionStrategy, ContextInterface $context = null)

No description

string
getVersion(string $path)

Returns the asset version for an asset.

from Package
string
getUrl(string $path)

Returns an absolute or root-relative public path.

getContext()

No description

from Package
isAbsoluteUrl($url)

No description

from Package
string
getBasePath()

Returns the base path.

Details

at line 35
__construct($basePath, VersionStrategyInterface $versionStrategy, ContextInterface $context = null)

Parameters

$basePath
VersionStrategyInterface $versionStrategy
ContextInterface $context

in Package at line 38
string getVersion(string $path)

Returns the asset version for an asset.

Parameters

string $path A path

Return Value

string The version string

at line 53
string getUrl(string $path)

Returns an absolute or root-relative public path.

Parameters

string $path A path

Return Value

string The public path

in Package at line 58
protected ContextInterface getContext()

Return Value

ContextInterface

in Package at line 66
protected VersionStrategyInterface getVersionStrategy()

in Package at line 71
protected isAbsoluteUrl($url)

Parameters

$url

at line 74
string getBasePath()

Returns the base path.

Return Value

string The base path