Skip to content
PHP Ecosystem
Explore

AbstractManifestAssetManager

API reference › Foxy › Asset › AbstractManifestAssetManager

abstract classFoxy\Asset\AbstractManifestAssetManager
ImplementsAssetManagerInterface
Sourcesrc/Asset/AbstractManifestAssetManager.php
2 subclasses

Provides the asset manifest handling shared by every asset manager: dependency merging, root package paths, and lock file detection.

PropertyTypeDescriptionDefined by
$config protected constructorFoxy\Config\ConfigFoxy configuration.AbstractManifestAssetManager
$fs protected constructorComposer\Util\FilesystemFilesystem used to resolve and update manifest paths.AbstractManifestAssetManager
$io protected constructorComposer\IO\IOInterfaceComposer output used for progress messages.AbstractManifestAssetManager
$updatable protectedboolWhether an existing frontend installation may be updated. Default: true.AbstractManifestAssetManager
MethodDescriptionDefined by
__construct()Creates a manager with the services shared by asset manifest operations.AbstractManifestAssetManager
addDependencies()Merges Composer asset dependencies into the frontend package manifest.AbstractManifestAssetManager
audit() abstractRuns the security audit of the locked dependencies.AssetManagerInterface
getAuditParser() abstractReturns the parser of this manager’s audit report.AssetManagerInterface
getLockPackageName() abstractGet the filename of the lock file.AssetManagerInterface
getName() abstractGet the name of asset manager.AssetManagerInterface
getPackageJsonPath()Returns the frontend package manifest path.AbstractManifestAssetManager
getPackageName()Returns the frontend package manifest filename.AbstractManifestAssetManager
getVersionConstraint() abstractGet the supported version constraint of the asset manager.AssetManagerInterface
hasLockFile()Returns whether the manager lock file exists.AbstractManifestAssetManager
isAvailable() abstractCheck if the asset manager is available.AssetManagerInterface
isInstalled()Returns whether both the dependency directory and package manifest exist.AbstractManifestAssetManager
isUpdatable()Returns whether an existing frontend installation may be updated.AbstractManifestAssetManager
run() abstractRun the asset manager to install/update the asset dependencies.AssetManagerInterface
setUpdatable()Enables or disables updates of an existing frontend installation.AbstractManifestAssetManager
validate() abstractValidate the version of asset manager.AssetManagerInterface
actionWhenComposerDependenciesAreAlreadyInstalled() protectedHandles dependencies already present in the frontend installation.AbstractManifestAssetManager
actionWhenComposerDependenciesAreMerged() protectedRuns after the Composer asset dependencies are merged and before the asset package is written.AbstractManifestAssetManager
getLockFilePath() protectedReturns the manager lock-file path under the root package directory.AbstractManifestAssetManager
getManagerConfig() protectedReturns the configuration scoped to this manager, so manager-* map entries resolve to its own value.AbstractManifestAssetManager
getManagerWorkingDirectory() protectedReturns the configured manager working directory, or null to use the process default.AbstractManifestAssetManager
getNodeModulesPath() protectedReturns the node_modules path under the root package directory.AbstractManifestAssetManager
getRootPackageDir() protectedReturns the resolved root package directory.AbstractManifestAssetManager
getRootPackagePath() protectedResolves a path under the root package directory.AbstractManifestAssetManager
ConstantValueDescriptionDefined by
NODE_MODULES_PATH'./node_modules'AbstractManifestAssetManager
public function __construct(Composer\IO\IOInterface $io, Foxy\Config\Config $config, Composer\Util\Filesystem $fs)

Creates a manager with the services shared by asset manifest operations.

Parameters

ParameterTypeDescription
$ioComposer\IO\IOInterfaceComposer output used for progress messages.
$configFoxy\Config\ConfigFoxy configuration.
$fsComposer\Util\FilesystemFilesystem used to resolve and update manifest paths.
public function addDependencies(Composer\Package\RootPackageInterface $rootPackage, array $dependencies): Foxy\Asset\AssetPackageInterface

Merges Composer asset dependencies into the frontend package manifest.

Parameters

ParameterTypeDescription
$rootPackageComposer\Package\RootPackageInterface
$dependenciesarray

Returns

AssetPackageInterface

Throws

  • Exception|Seld\JsonLint\ParsingException
public function getPackageJsonPath(): string

Returns the frontend package manifest path.

Returns

string

public function getPackageName(): string

Returns the frontend package manifest filename.

Returns

string

public function hasLockFile(): bool

Returns whether the manager lock file exists.

Returns

bool

public function isInstalled(): bool

Returns whether both the dependency directory and package manifest exist.

Returns

bool

public function isUpdatable(): bool

Returns whether an existing frontend installation may be updated.

Returns

bool

public function setUpdatable(bool $updatable): static

Enables or disables updates of an existing frontend installation.

Parameters

ParameterTypeDescription
$updatablebool

Returns

static

actionWhenComposerDependenciesAreAlreadyInstalled()

Section titled “actionWhenComposerDependenciesAreAlreadyInstalled() ”
protected function actionWhenComposerDependenciesAreAlreadyInstalled(list<string> $names): void

Handles dependencies already present in the frontend installation.

Parameters

ParameterTypeDescription
$nameslist<string>The asset package name of composer dependencies.

actionWhenComposerDependenciesAreMerged()

Section titled “actionWhenComposerDependenciesAreMerged() ”
protected function actionWhenComposerDependenciesAreMerged(Foxy\Asset\AssetPackageInterface $assetPackage, array<string, mixed> $previousDependencies): void

Runs after the Composer asset dependencies are merged and before the asset package is written.

Parameters

ParameterTypeDescription
$assetPackageAssetPackageInterfaceThe asset package with the merged Composer dependencies.
$previousDependenciesarray<string, mixed>The Composer asset dependencies declared before the merge.
protected function getLockFilePath(): string

Returns the manager lock-file path under the root package directory.

Returns

string

protected function getManagerConfig(): Foxy\Config\Config

Returns the configuration scoped to this manager, so manager-* map entries resolve to its own value.

The view is built on each call because getName() must not run from a constructor.

protected function getManagerWorkingDirectory(): string|null

Returns the configured manager working directory, or null to use the process default.

Returns

string|null

protected function getNodeModulesPath(): string

Returns the node_modules path under the root package directory.

Returns

string

protected function getRootPackageDir(): string

Returns the resolved root package directory.

Returns

string

protected function getRootPackagePath(string $path): string

Resolves a path under the root package directory.

Parameters

ParameterTypeDescription
$pathstring

Returns

string