Are you tired of typing
php [PATH]/composer.phar on the console all the time? Wouldn’t it be easier to just type
composer and you’re done? Fortunately this isn’t very hard to configure.
composer.phar file to some folder, e.g. somewhere in your “Program Files” folder. I assume it’s
C:\Program Files\Composer in this little tutorial.
Add a BAT file named
composer.bat to that folder, which contains:
SET "COMPOSER_INSTALL_DIR=C:\Program Files\Composer"
php "%COMPOSER_INSTALL_DIR%\composer.phar" %*
C:\Program Files\Composer to the
PATH setting of you operating system. If you don’t know how it works, just Google it.
Note: If PHP isn’t runable on your console via a simple
php, you should also add your PHP folder to the
PATH setting. Otherwise you have to write the full path to
php.exe in the BAT file.
Now you can run the Composer commands from any folder:
composer self-update # (may only work if the console runs with admin privileges)
The same works for PHPUnit’s phar distribution.