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 • Principal Software Engineer @Chargebee 👨‍💻• I write about web development & behinds the scenes of startup/side projects that I'm building

© 2022 Nesin Technologies LLP