Is there any way to install Composer globally on Windows?

后端 未结 13 1533
予麋鹿
予麋鹿 2020-11-30 18:32

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

curl -s https://ge         


        
13条回答
  •  [愿得一人]
    2020-11-30 19:08

    An alternative variant (see Lusitanian answer) is to register .phar files as executable on your system, exemplary phar.reg file:

    Windows Registry Editor Version 5.00
    
    [HKEY_CLASSES_ROOT\.phar]
    @="phar_auto_file"
    
    [HKEY_CLASSES_ROOT\phar_auto_file\shell\open\command]
    @="\"c:\\PROGRA~1\\php\\php.exe\" \"%1\" %*"
    

    Just replace the path to php.exe to your PHP executable. You can then also extend the %PATHEXT% commandline variable with .PHAR which will allow you to type composer instead of composer.phar as long as composer.phar is inside the %Path%.

提交回复
热议问题