vever001 / composer-installers-dir
Small composer plugin using composer/installers that allows you to add an additional directory to package destinations.
Installs: 20
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Type:composer-plugin
Requires
- composer-plugin-api: ^1.0
- composer/installers: ^1.0
Requires (Dev)
- composer/composer: 1.0.*@dev
This package is auto-updated.
Last update: 2025-03-01 00:22:12 UTC
README
The composer-installers-dir
is a small composer plugin that allows you to specify a directory where all packages
handled by composer/installers
will be downloaded to.
Composer supports overriding the vendor location using vendor-dir
out of the box.
This is not the case for packages using composer/installers
.
This project allows you to define similarly an installer-dir
in the extra
section of your composer.json
.
To install it:
composer require vever001/composer-installers-dir
This is useful if you have a composer project and you want to build it to another folder (e.g: for production release).
Here's an example to build the whole project in a dist
folder for production release:
DIR="dist" composer config vendor-dir "$DIR/vendor" composer config extra.installer-dir "$DIR" composer install --no-dev composer config --unset extra.installer-dir composer config --unset vendor-dir cp composer.json composer.lock $DIR composer dump-autoload --working-dir="$DIR" --no-dev --optimize
Which will:
- Add the following in the composer.json
"extra": { ... "installer-dir": "dist" }, "config": { ... "vendor-dir": "dist/vendor" }
- Build the project to the
dist
folder (with--no-dev
) - Revert the changes to the
composer.json
- Copy
composer.json
andcomposer.lock
to thedist
folder - Update the autoloader in the
dist
folder to resolve paths