Skip to content
PHP Ecosystem
Explore

Requirement

API reference › Foxy › Native › Requirement

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

Represents one dependency requirement fed to the native resolver: a package name, its npm specification, and the manifest or package that declared it.

PropertyTypeDescriptionDefined by
$name readonly constructorstringPackage name, scoped names included (@scope/name).Requirement
$optional readonly constructorboolWhether an unsatisfiable requirement is skipped with a warning instead of failing. Default: false.Requirement
$optionalRoot readonly constructorstring|nullSelection (name@version) of the optional package whose subtree declared the requirement, or null outside any optional subtree. Default: null.Requirement
$source readonly constructorstringDeclaring origin: '' for the root manifest, the local package name, or name@version.Requirement
$spec readonly constructorstringNpm specification as written by the declaring manifest (range, version, or dist-tag).Requirement
MethodDescriptionDefined by
__construct()Describes one dependency constraint for the native resolver.Requirement
public function __construct(string $name, string $spec, string $source, bool $optional = false, string|null $optionalRoot = null)

Describes one dependency constraint for the native resolver.

Parameters

ParameterTypeDescription
$namestringPackage name, scoped names included (@scope/name).
$specstringNpm specification as written by the declaring manifest (range, version, or dist-tag).
$sourcestringDeclaring origin: '' for the root manifest, the local package name, or name@version.
$optionalboolWhether an unsatisfiable requirement is skipped with a warning instead of failing.
$optionalRootstring|nullSelection (name@version) of the optional package whose subtree declared the requirement, or null outside any optional subtree.