Documentation

JsonManifestVersionStrategy
in package
implements VersionStrategyInterface

Reads the versioned path of an asset from a JSON manifest file.

For example, the manifest file might look like this: { "main.js": "main.abc123.js", "css/styles.css": "css/styles.555abc.css" }

You could then ask for the version of "main.js" or "css/styles.css".

Table of Contents

Interfaces

VersionStrategyInterface
Asset version strategy interface.

Properties

$httpClient  : mixed
$manifestData  : array<string|int, mixed>
$manifestPath  : string
$strictMode  : bool

Methods

__construct()  : mixed
applyVersion()  : string
Applies version to the supplied path.
getVersion()  : string
With a manifest, we don't really know or care about what the version is. Instead, this returns the path to the versioned file.
findAlternatives()  : array<string|int, mixed>
getManifestPath()  : string|null

Properties

Methods

__construct()

public __construct(string $manifestPath[, HttpClientInterface $httpClient = null ][, bool $strictMode = false ]) : mixed
Parameters
$manifestPath : string

Absolute path to the manifest file

$httpClient : HttpClientInterface = null
$strictMode : bool = false

Throws an exception for unknown paths

applyVersion()

Applies version to the supplied path.

public applyVersion(string $path) : string
Parameters
$path : string
Return values
string

getVersion()

With a manifest, we don't really know or care about what the version is. Instead, this returns the path to the versioned file.

public getVersion(string $path) : string
Parameters
$path : string
Return values
string

findAlternatives()

private findAlternatives(string $path, array<string|int, mixed> $manifestData) : array<string|int, mixed>
Parameters
$path : string
$manifestData : array<string|int, mixed>
Return values
array<string|int, mixed>

getManifestPath()

private getManifestPath(string $path) : string|null
Parameters
$path : string
Return values
string|null

        
On this page

Search results