PHPackages                             mindplay/composer-locator - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. mindplay/composer-locator

Abandoned → composer-runtime-apiArchivedComposer-plugin[Utility &amp; Helpers](/categories/utility)

mindplay/composer-locator
=========================

Locates Composer package root folders by package name

2.1.5(2y ago)58496.9k↓27.1%6[1 PRs](https://github.com/mindplay-dk/composer-locator/pulls)18MITPHPPHP &gt;= 7.4

Since Apr 19Pushed 2y ago4 watchersCompare

[ Source](https://github.com/mindplay-dk/composer-locator)[ Packagist](https://packagist.org/packages/mindplay/composer-locator)[ RSS](/packages/mindplay-composer-locator/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (5)Versions (14)Used By (18)

mindplay/composer-locator
=========================

[](#mindplaycomposer-locator)

### ⚠️ DEPRECATED: use [Composer Runtime Utilities](https://getcomposer.org/doc/07-runtime.md)

[](#️-deprecated-use-composer-runtime-utilities)

This Composer plugin provides a means of locating the installation path for a given Composer package name.

[![PHP Version](https://camo.githubusercontent.com/dcf732129b3cd504ec44ecaf7695d7bd5f850ff23f38e090dbc3184fbfdfb772/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d372e335f2d2d5f382e332532422d626c75652e737667)](https://packagist.org/packages/mindplay/composer-locator)[![CI](https://github.com/mindplay-dk/composer-locator/actions/workflows/ci.yml/badge.svg)](https://github.com/mindplay-dk/composer-locator/actions/workflows/ci.yml)

Use this to locate vendor package roots, e.g. when working with template files or other assets in a package, locating and discovering plugins, and so on.

It works regardless of installers affecting the individual package installation paths, and also works whether the package in question is currently the root package/project or a dependency.

### Usage

[](#usage)

Add to your `composer.json` file:

```
{
    "require": {
        "mindplay/composer-locator": "^2"
    },
    "config": {
        "allow-plugins": {
            "mindplay/composer-locator": true
        }
    }
}
```

Running `composer install` or `composer update` will bootstrap your project with a generated class containing a registry of Composer package installation paths.

To obtain the installation path for given package:

```
$path = ComposerLocator::getPath("vendor/package"); // => "/path/to/vendor/package"
```

If the specified package name is not found, the function throws a `RuntimeException`.

To check whether a given package is installed:

```
$is_installed = ComposerLocator::isInstalled("vendor/package"); // => (bool) true|false
```

The root Composer project package doesn't necessarily have a package name - to get the root path of the root Composer project, without specifying the package name:

```
$path = ComposerLocator::getRootPath(); // => "/path/to/project/root"
```

You can also get a list of all installed packages via `ComposerLocator::getPackages()`, or obtain a full key/value map of package-names to absolute root paths via `ComposerLocator::getPaths()`.

Why?
----

[](#why)

Needing to know the root path of a package installation folder is quite a common requirement, such as when you need to specify paths to template files or other assets.

The problem is that Composer itself offers no simple and reliable way to do that.

You can use reflection to get the path to a known class or interface from the package, and then `dirname()` up from your `src` folder to the package installation root, but that approach isn't very robust, since the location of a class file may change from one version to another.

Even if you know the path of the vendor root folder, and the `{vendor}/{package}` folder name convention, there is no guarantee that's always where packages are installed - something like [composer-installers](https://github.com/composer/installers)could affect the installation paths.

Also, when developing a library, during testing and development, the package will be installed as the root/project package, but this path will be different when it's installed as a dependency in another project.

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity47

Moderate usage in the ecosystem

Community25

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 91.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~294 days

Recently: every ~646 days

Total

11

Last Release

741d ago

Major Versions

1.0.1 → 2.0.02016-04-29

PHP version history (2 changes)2.0.1PHP &gt;= 5.4

2.1.5PHP &gt;= 7.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/9445f567f43ee7a963270651e40e533634586f959e4df3d5398d001b1cb49be8?d=identicon)[mindplay.dk](/maintainers/mindplay.dk)

---

Top Contributors

[![mindplay-dk](https://avatars.githubusercontent.com/u/103348?v=4)](https://github.com/mindplay-dk "mindplay-dk (21 commits)")[![MekDrop](https://avatars.githubusercontent.com/u/342641?v=4)](https://github.com/MekDrop "MekDrop (1 commits)")[![mnapoli](https://avatars.githubusercontent.com/u/720328?v=4)](https://github.com/mnapoli "mnapoli (1 commits)")

### Embed Badge

![Health badge](/badges/mindplay-composer-locator/health.svg)

```
[![Health](https://phpackages.com/badges/mindplay-composer-locator/health.svg)](https://phpackages.com/packages/mindplay-composer-locator)
```

###  Alternatives

[vaimo/composer-patches

Applies a patch from a local or remote file to any package that is part of a given composer project. Patches can be defined both on project and on package level. Optional support for patch versioning, sequencing, custom patch applier configuration and patch command for testing/troubleshooting added patches.

2994.3M16](/packages/vaimo-composer-patches)[mglaman/composer-drupal-lenient

1317.4M15](/packages/mglaman-composer-drupal-lenient)[drupal/core-composer-scaffold

A flexible Composer project scaffold builder.

5341.9M446](/packages/drupal-core-composer-scaffold)[drupal/core-project-message

Adds a message after Composer installation.

2122.6M172](/packages/drupal-core-project-message)[olvlvl/composer-attribute-collector

A convenient and near zero-cost way to retrieve targets of PHP 8 attributes

184108.8k8](/packages/olvlvl-composer-attribute-collector)[lullabot/drainpipe

An automated build tool to allow projects to have a set standardized operations scripts.

41716.4k2](/packages/lullabot-drainpipe)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
