Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. InstalledVersions.php

function InstalledVersions::getInstallPath

Same name in this branch
  1. 11.1.x vendor/composer/composer/src/Composer/InstalledVersions.php \Composer\InstalledVersions::getInstallPath()

Parameters

string $packageName:

Return value

string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path.

1 call to InstalledVersions::getInstallPath()
DrupalFinderComposerRuntime::getDrupalRoot in vendor/webflo/drupal-finder/src/DrupalFinderComposerRuntime.php
Get the Drupal root path.

File

vendor/composer/InstalledVersions.php, line 236

Class

InstalledVersions
This class is copied in every Composer installed project and available to all

Namespace

Composer

Code

public static function getInstallPath($packageName) {
    foreach (self::getInstalled() as $installed) {
        if (!isset($installed['versions'][$packageName])) {
            continue;
        }
        return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
    }
    throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal