function PathLocator::getProjectRoot
Returns the absolute path of the project root.
This is where the project-level composer.json should normally be found, and may or may not be the same path as the Drupal code base.
Return value
string The absolute path of the project root.
File
-
core/
modules/ package_manager/ src/ PathLocator.php, line 31
Class
- PathLocator
- Computes file system paths that are needed to stage code changes.
Namespace
Drupal\package_managerCode
public function getProjectRoot() : string {
// Assume that the vendor directory is immediately below the project root.
return realpath($this->getVendorDirectory() . DIRECTORY_SEPARATOR . '..');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.