ProjectRootFinder
API reference › Scaffold › Config › ProjectRootFinder
Finds the project root by walking up from a directory to the nearest one that contains the Composer manifest.
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
find() static | Returns the nearest directory, starting at $directory and walking up, that contains the Composer manifest named by VendorDirResolver::manifestName(). | ProjectRootFinder |
Method details
Section titled “Method details”find()
Section titled “find() ”public static function find(string $directory): string|nullReturns the nearest directory, starting at $directory and walking up, that contains the Composer manifest
named by VendorDirResolver::manifestName().
An absolute manifest path is not searched for: its directory is the project root, as for the Composer plugin.
Parameters
| Parameter | Type | Description |
|---|---|---|
$directory | string | Absolute path of the directory where the search starts. |
Returns
string|null: Absolute path of the project root, or null when the filesystem root is reached first or the absolute manifest does not exist.