Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Composer uses %APPDATA%Composer directory by default for global packages.
So I need to add %APPDATA%Composervendorin path to my user PATH environment variable.

Can I change installation directory to something like C:phpcomposer? How can I do it?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
445 views
Welcome To Ask or Share your Answers For Others

1 Answer

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}AppDataRoaming`.

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

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

Windows system settings
(source: w3guy.com)

Click the Environmental variables button.

Environmental variable button
(source: w3guy.com)

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

Add environmental variables in Windows
(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/


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...