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
Properties
- $basePath : string
- $context : mixed
- $versionStrategy : mixed
Methods
- __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
string
$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
getBasePath()
Returns the base path.
public
getBasePath() : string
Return values
stringgetUrl()
Returns an absolute or root-relative public path.
public
getUrl(string $path) : string
Parameters
- $path : string
Return values
stringgetVersion()
Returns the asset version for an asset.
public
getVersion(string $path) : string
Parameters
- $path : string
Return values
stringgetContext()
protected
getContext() : ContextInterface
Return values
ContextInterfacegetVersionStrategy()
protected
getVersionStrategy() : VersionStrategyInterface
Return values
VersionStrategyInterfaceisAbsoluteUrl()
protected
isAbsoluteUrl(string $url) : bool
Parameters
- $url : string