Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Composer global, system-wide, multi-user install

My question is quite simple to understand: I have a Debian server, where I'd like to install and use composer and its global dependencies in a multi-user way (like, say, RVM).

I've always managed to install composer itself, and to make it available for any user (as long as the user has shell access and +x chmod, of course).

What I would love to do, is that when I run composer global require wp-cli/wp-cli, the required dependency is installed in a "public" location (say /usr/local/.composer for example).

So if I set the right permissions on this directory, any user that can access /usr/local/.composer can use global dependencies.

Is that clear enough?

Someone out there with an anwser?

Thanks!

like image 918
Michel Tomas - superbiche Avatar asked Oct 27 '15 23:10

Michel Tomas - superbiche


1 Answers

You can change the default directory where composer sets its global dependencies to be the one you like:

Just create the environment variable COMPOSER_HOME and make it available to all users, take a look at /etc/profile or /etc/bash.bashrc

COMPOSER_HOME="/usr/local/composer" 
like image 133
lebobbi Avatar answered Oct 04 '22 16:10

lebobbi