Download the PHP package mindplay/composer-locator without Composer

On this page you can find all versions of the php package mindplay/composer-locator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package composer-locator

mindplay/composer-locator

⚠️ DEPRECATED: use Composer Runtime Utilities

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

PHP Version CI

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

Add to your composer.json file:

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:

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

To check whether a given package is installed:

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:

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?

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 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.


All versions of composer-locator with dependencies

PHP Build Version
Package Version
Requires php Version >= 7.4
composer-plugin-api Version ^1.0 || ^2.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package mindplay/composer-locator contains the following files

Loading the files please wait ....