How to install Composer packages in custom directory

December 23, 2015

When we install packages using composser. It just basically creates a new directory called vendor and install all the packages in it.

Most of the time we may need to change its location.

You can do that by using vendor-dir

Here’s a composer.json file where I’ve changed its directory

{
  "require": {
    "sendgrid/sendgrid": "~3.2"
  },
  "config": {
    "vendor-dir": "backend/vendor/"
  }
}

👋 I'm Ashik Nesin • Sr. Frontend Engineer @Chargebee 👨‍💻• I write about modern Javascript & building web apps

© 2021 Nesin Technologies LLP