I've been tinkering with composer recently (on windows) and I noticed there was no simple way to install it system wide. Typically the composer.phar would live within the root of your project directory and so you'd manage your dependencies from there.
But as I would like to manage several projects with it I thought it would be cleaner to have the composer.phar in one place. That way any updates to the composer.phar will only need to be done once. A system wide installation is outlined in the documentation for Linux, but there aren't any pointers for windows.
So to get around problem this I created a small .bat file and copied it to the same directory that my php binary exists, accompanied with the composer.phar file this now runs from anywhere.
To repeat the steps..
php -r "eval('?>'.file_get_contents('https://getcomposer.org/installer'));"
echo "@ECHO OFF" "php '%~dp0composer.phar' %*" > composer.bat
And your done (you may have to restart your terminal). Just type in "composer" and you should see the usage options.
Tip: If you're using windows powershell you might get the following warning;
'■@' is not recognized as an internal or external command,
If that's the case simply delete the composer.bat file, create a new file, copy in the following contents and save as composer.bat:
@ECHO OFF php "%~dp0composer.phar" %*