gremo gremo - 7 months ago 17
PHP Question

Is there any way to install Composer globally on Windows?

I've read the global installation documentation for Composer, but it's for *nix systems only:



curl -s https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer


I would be such happy doing the same on Windows, that's the OS of my development machine. I would be able to run

composer update


From an arbitrary folder where
composer.json
exists. Interpreter
php.exe
is already in
PATH
variable.

Any clue?

Answer

Sure. Just put composer.phar somewhere like C:\php\composer.phar, then make a batch file somewhere within the PATH called composer.bat which does the following:

@ECHO OFF
php "%~dp0composer.phar" %*

The "%*" repeats all of the arguments passed to the shell script.

Then you can run around doing composer update all ya want!