Skip to content
PHP Ecosystem
Explore

VendorDirResolver

API reference › Scaffold › Config › VendorDirResolver

final classPHPForge\Scaffold\Config\VendorDirResolver
Sourcesrc/Config/VendorDirResolver.php

Resolves the Composer vendor directory of a project from COMPOSER_VENDOR_DIR, then config.vendor-dir in the project manifest (composer.json, or the file named by COMPOSER), then <project-root>/vendor.

MethodDescriptionDefined by
manifestName() staticReturns the file name of the project manifest: the COMPOSER environment variable when set, otherwise composer.json.VendorDirResolver
manifestPath() staticReturns the absolute path of the project manifest named by VendorDirResolver::manifestName().VendorDirResolver
resolve() staticReturns the absolute path to the vendor directory for the project rooted at $projectRoot.VendorDirResolver
public static function manifestName(): string

Returns the file name of the project manifest: the COMPOSER environment variable when set, otherwise composer.json.

Returns

string: Manifest file name, relative to the project root unless the COMPOSER value is absolute.

public static function manifestPath(string $projectRoot): string

Returns the absolute path of the project manifest named by VendorDirResolver::manifestName().

Parameters

ParameterTypeDescription
$projectRootstringAbsolute path to the project root directory.

Returns

string: Absolute path of the project manifest.

public static function resolve(string $projectRoot, string|null $configured = null): string

Returns the absolute path to the vendor directory for the project rooted at $projectRoot.

Parameters

ParameterTypeDescription
$projectRootstringAbsolute path to the project root directory.
$configuredstring|nullconfig.vendor-dir of the project manifest, or null when unset.

Returns

string: Absolute path to the resolved vendor directory.