Skip to content
PHP Ecosystem
Explore

ResolvedPackage

API reference › Foxy › Native › ResolvedPackage

final readonly classFoxy\Native\ResolvedPackage
Sourcesrc/Native/ResolvedPackage.php

Represents a package chosen for installation: a registry tarball or a local file: directory.

PropertyTypeDescriptionDefined by
$integrity readonly constructorstring|nullSubresource Integrity value of a registry package. Default: null.ResolvedPackage
$name readonly constructorstringPackage name.ResolvedPackage
$path readonly constructorstring|nullLocal package directory: the manifest’s file: value without the prefix, as written. Default: null.ResolvedPackage
$resolved readonly constructorstring|nullTarball URL of a registry package. Default: null.ResolvedPackage
$version readonly constructorstringInstalled version.ResolvedPackage
MethodDescriptionDefined by
__construct()Describes a registry or local package selected for installation.ResolvedPackage
fromLocal() staticCreates a local package from a file: dependency.ResolvedPackage
fromRegistry() staticCreates a registry package from the selected version’s tarball URL and integrity value.ResolvedPackage
isLocal()Returns whether the package is copied from a local directory instead of downloaded from the registry.ResolvedPackage
toLock()Returns the package entry written to foxy.lock.ResolvedPackage
public function __construct(string $name, string $version, string|null $resolved = null, string|null $integrity = null, string|null $path = null)

Describes a registry or local package selected for installation.

Parameters

ParameterTypeDescription
$namestringPackage name.
$versionstringInstalled version.
$resolvedstring|nullTarball URL of a registry package.
$integritystring|nullSubresource Integrity value of a registry package.
$pathstring|nullLocal package directory: the manifest’s file: value without the prefix, as written.
public static function fromLocal(string $name, string $version, string $path): self

Creates a local package from a file: dependency.

Parameters

ParameterTypeDescription
$namestring
$versionstring
$pathstring

Returns

self

public static function fromRegistry(Foxy\Native\PackageVersion $version): self

Creates a registry package from the selected version’s tarball URL and integrity value.

Parameters

ParameterTypeDescription
$versionPackageVersion

Returns

self

public function isLocal(): bool

Returns whether the package is copied from a local directory instead of downloaded from the registry.

Returns

bool

public function toLock(): array{version: string, file: string}|array{version: string, resolved: string, integrity: string}

Returns the package entry written to foxy.lock.

Returns

array{version: string, file: string}|array{version: string, resolved: string, integrity: string}