webflo/drupal-finder
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|
Webflo/drupal-finder is a handy Composer package that helps users to locate a Drupal installation from any given path. This useful class enables developers and users who work with Drupal to conveniently find the root directory of their Drupal installations.
Utilizing webflo/drupal-finder is a straightforward process and the package can be used following these steps:
Firstly, you need to instantiate a new DrupalFinder object. After that, call the locateRoot method on this object, passing in the current working directory. If a Drupal installation is identified in that path, it will return true, and you can then use getDrupalRoot and getComposerRoot methods to retrieve the Drupal and Composer root directories respectively.
The PHP code below demonstrates how one would use the DrupalFinder:
$drupalFinder = new \DrupalFinder\DrupalFinder();
if ($drupalFinder->locateRoot(getcwd())) {
$drupalRoot = $drupalFinder->getDrupalRoot();
$composerRoot = $drupalFinder->getComposerRoot();
...
}
The documentation for webflo/drupal-finder is available at the project's GitHub page. The examples and usage instructions provided in the readme file guide both PHP and Drupal developers through the process. Additional examples of how this package is used in other projects can be found in the "Examples" section -- specifically in the Drupal Console Launcher and Drush Launcher projects.