[英]Create a working alias for composer in Windows 7
I'm not sure that this is a Path alias, but I'm not sure how to do this in Windows 7. 我不确定这是否是Path别名,但是我不确定如何在Windows 7中执行此操作。
When I run PHP composer, it shows all composer options, as expected. 当我运行PHP composer时,它会按预期显示所有composer选项。
However if I try to run in like 但是如果我尝试像
C:\>php composer.phar composer global update squizlabs/php_codesniffer:2.9.1
it returns 它返回
[Symfony\\Component\\Console\\Exception\\CommandNotFoundException]
[Symfony \\ Component \\ Console \\ Exception \\ CommandNotFoundException]
Command "composer" is not defined.未定义命令“ composer”。
EDIT: I had to install this behind a proxy, and I couldn't use a installer. 编辑:我必须在代理服务器后面安装它,并且我不能使用安装程序。
How can I create a working alias for simply running 如何为简单运行创建工作别名
c:\\somewhere\\anywhere\\ composer
c:\\ somewhere \\ anywhere \\
composer
instead of php composer.phar so that I can call composer from anywhere on the filesystem and not only inside the php directory? 而不是php composer.phar,这样我就可以从文件系统上的任何地方调用composer,而不仅是在php目录中?
Here's what I did for Windows PowerShell. 这是我为Windows PowerShell做的。 I know you asked for help to add this to your PATH, but sadly this was the best that I was able to come up with.
我知道您需要帮助将其添加到您的PATH,但可悲的是,这是我能想到的最好的方法。
$PROFILE
, but you might want to edit something a bit more personal like $PROFILE.CurrentUserCurrentHost
or $PROFILE.CurrentUserAllHosts
. I ended up using the latter as I want to be able to use this in PowerShell ISE and the regular command line. $PROFILE
,但您可能想要编辑一些更个人化的内容,例如$PROFILE.CurrentUserCurrentHost
或$PROFILE.CurrentUserAllHosts
。由于要在PowerShell ISE中使用它,我最终使用了后者和常规命令行。 function composer { php $HOME\\composer.phar $ARGS }
function composer { php $HOME\\composer.phar $ARGS }
That should do the trick, I can now do the following: 那应该可以解决问题,我现在可以执行以下操作:
PS C:\Users\NathanWindisch> composer
______
/ ____/___ ____ ___ ____ ____ ________ _____
/ / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
/_/
Composer version 1.8.5 2019-04-09 17:46:47
Usage:
command [options] [arguments]
...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.