PathPackage
extends Package
in 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.
Tags
Table of Contents
- $basePath : mixed
- $context : mixed
- $versionStrategy : mixed
- __construct() : mixed
- getBasePath() : string
- Returns the base path.
- getUrl() : string
- Returns an absolute or root-relative public path.
- getVersion() : string
- Returns the asset version for an asset.
- getContext() : ContextInterface
- getVersionStrategy() : VersionStrategyInterface
- isAbsoluteUrl() : bool
Properties
$basePath
private
mixed
$basePath
$context
private
mixed
$context
$versionStrategy
private
mixed
$versionStrategy
Methods
__construct()
public
__construct(string $basePath, VersionStrategyInterface $versionStrategy[, ContextInterface $context = null ]) : mixed
Parameters
- $basePath : string
-
The base path to be prepended to relative paths
- $versionStrategy : VersionStrategyInterface
- $context : ContextInterface = null
Return values
mixed —getBasePath()
Returns the base path.
public
getBasePath() : string
Return values
string —The base path
getUrl()
Returns an absolute or root-relative public path.
public
getUrl(mixed $path) : string
Parameters
- $path : mixed
-
A path
Return values
string —The public path
getVersion()
Returns the asset version for an asset.
public
getVersion(mixed $path) : string
Parameters
- $path : mixed
-
A path
Return values
string —The version string
getContext()
protected
getContext() : ContextInterface
Return values
ContextInterface —getVersionStrategy()
protected
getVersionStrategy() : VersionStrategyInterface
Return values
VersionStrategyInterface —isAbsoluteUrl()
protected
isAbsoluteUrl(mixed $url) : bool
Parameters
- $url : mixed