Where to find composer's global packages?

2020-05-15 10:23发布

问题:

For a plugin for Sublime Text I was required to install a composer package globally.

In order to do this I had to run the following command:

composer global require "asm89/twig-lint" "@stable"

The installation started running and a few seconds later the package was installed. Voila! Well, not really.

Step two was to add some lines to my Sublime Text configuration file:

{
    "user": {
        "paths": {
            "windows": ["C:\\Users\\yourname\\.composer\\vendor\\bin"]
        },
    }
}

However, the plugin is not working. So I decided to check the path. And it appears there is no .composer directory in my profile directory. It isn't in my php directory either. And I can't find it anywhere.

I would like to know if there's a way to locate this directory and would appreciate any suggestions that can help me get this plugin to work.

回答1:

You can query Composer to find where it has set the user $COMPOSER_HOME directory.

composer config --list --global

The '[home]' line refers to the default value of $COMPOSER_HOME.

Just as a final confirmation - the 'yourname' part in the configuration, would very likely need to be updated with your own Windows username - composer config will say where it put the files.



回答2:

You may find in ~/.config/composer/vendor/bin



回答3:

On Windows, mine was /Users/taylor/AppData/Roaming/Composer/bin



回答4:

Run the command

composer config --list --global | grep -w home

You can find the find the [home] with composer path, similar to this one.

[home] /home/example_username/.config/composer