W3cubDocs

/Symfony 4.1

PathPackage

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(string $basePath, VersionStrategyInterface $versionStrategy, ContextInterface $context = null)
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.

ContextInterface getContext() from Package
VersionStrategyInterface getVersionStrategy() from Package
isAbsoluteUrl($url) from Package
string getBasePath()

Returns the base path.

Details

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

Parameters

string $basePath The base path to be prepended to relative paths
VersionStrategyInterface $versionStrategy
ContextInterface $context

string getVersion(string $path)

Returns the asset version for an asset.

Parameters

string $path A path

Return Value

string The version string

string getUrl(string $path)

Returns an absolute or root-relative public path.

Parameters

string $path A path

Return Value

string The public path

protected ContextInterface getContext()

Return Value

ContextInterface

protected VersionStrategyInterface getVersionStrategy()

Return Value

VersionStrategyInterface

protected isAbsoluteUrl($url)

Parameters

$url

string getBasePath()

Returns the base path.

Return Value

string The base path

© 2004–2017 Fabien Potencier
Licensed under the MIT License.
https://api.symfony.com/4.1/Symfony/Component/Asset/PathPackage.html