Change composer global path (Windows)

前端 未结 3 1653
渐次进展
渐次进展 2020-12-14 17:17

Composer uses %APPDATA%\\Composer directory by default for global packages.
So I need to add %APPDATA%\\Composer\\vendor\\bin path to my user P

相关标签:
3条回答
  • 2020-12-14 17:59

    I found an answer in the source code: https://github.com/composer/composer/blob/master/src/Composer/Factory.php#L45

    So environment variable COMPOSER_HOME must be defined as C:\php\composer.

    0 讨论(0)
  • 2020-12-14 18:04

    Go to folder

    (C:\Users(your user)\AppData\Roaming\Composer )

    Then create new folder (vendor)

    and

    in vendor create (bin) and copy (C:\composer\composer.phar) to (bin) .

    0 讨论(0)
  • 2020-12-14 18:17

    On Windows, when global install of a library / package is done, composer stores the package in a Composer directory inside windows **application data folders** which by default is C:\Users{user name}\AppData\Roaming`.

    To change this folder to say C:\php\composer, create a COMPOSER_HOME environmental variable with the value set to C:\php\composer.

    The steps below explain how environmental variables are added in Windows. * Press Windows Key + Pause Break then click Advanced system Settings


    (source: w3guy.com)

    Click the Environmental variables button.


    (source: w3guy.com)

    Under System variables, click New... button and add the environmental variable like so:


    (source: w3guy.com)

    You might want to restart your PC for this to take effect.

    Credit: http://w3guy.com/change-composer-global-package-install-folder-windows/

    0 讨论(0)
提交回复
热议问题