Skip to content
Advertisement

Composer install to target folder

I am using Composer v1.10.6 and am trying to get the dependencies to install into a specific folder. File structure is like this:

/some-folder
composer.json
composer.lock

So I want the dependencies defined in composer.json to be installed under /some-folder/vendor, but they are just getting installed to /vendor. What property do I add to composer.json to make this happen? I see there used to be a target-dir property, but it is deprecated.

I want to do this in composer.json so I can install dependencies just with composer install, not something like composer install --dir=/some-folder.

Thank you.

Advertisement

Answer

Try setting config.vendor-dir in your composer.json like this:

{
    "config": {
        "vendor-dir": "some-folder"
    }
}
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement