Since I am running a dev environment on a Vagrant machine (and the app I am working on runs way faster by not having the vendor directory in a shared folder), I need to specify a custom path for the location of the project's vendor directory.
I wouldn't want to specify the custom path in the composer.json configuration (with the "vendor-dir" parameter) as this would cause issues to other developers who are working on the project.
For now, I have resolved by setting the vendor parameter by exporting the COMPOSER_VENDOR_DIR environment variable in my .bash_profile.
However, the problem with this solution is that I now have conflicts when installing packages globally and also installing project specific packages. E.g. doing a composer install for my project will detect that the vendor directory contains dependencies that are not specified in the project manifest and therefore it removes them.
TL;DR Are there other ways to specify a project vendor path for my project (other than having to change the project's composer.json file) but still by not sharing the packages with the ones that are installed globally?