php 哪里可以找到 composer 的全局包?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/30664220/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 21:58:05  来源:igfitidea点击:

Where to find composer's global packages?

phpsublimetext2composer-phpsublimetext

提问by Peter

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

对于 Sublime Text 的插件,我需要全局安装一个 composer 包。

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:

第二步是在我的 Sublime Text 配置文件中添加一些行:

{
    "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 .composerdirectory in my profile directory. It isn't in my phpdirectory either. And I can't find it anywhere.

但是,该插件不起作用。所以我决定检查路径。并且.composer我的配置文件目录中似乎没有目录。它也不在我的php目录中。而且我在任何地方都找不到。

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.

我想知道是否有办法找到这个目录,并希望得到任何可以帮助我让这个插件工作的建议。

回答by Alister Bulman

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

您可以查询 Composer 以查找它设置用户$COMPOSER_HOME目录的位置。

composer config --list --global

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

'[home]' 行指的是默认值$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 configwill say where it put the files.

作为最后的确认——配置中的“你的名字”部分很可能需要使用你自己的 Windows 用户名进行更新——composer config会说明文件的放置位置。

回答by Jay Soni

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

您可以在 ~/.config/composer/vendor/bin 中找到

回答by Madan Sapkota

Run the command

运行命令

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

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

您可以找到 find [home]with composer 路径,类似于这个。

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

回答by Taylor Evanson

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

在 Windows 上,我的是 /Users/taylor/AppData/Roaming/Composer/bin