有没有办法在Windows上全局安装Composer? [英] Is there any way to install Composer globally on Windows?

查看:452
本文介绍了有没有办法在Windows上全局安装Composer?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已阅读Composer的全局安装文档,但仅适用于* nix系统:

  curl -s https://getcomposer.org/安装程序| php 
sudo mv composer.phar / usr / local / bin / composer



这样的快乐做同样的Windows,这是我的开发机器的操作系统。我将能够运行

  composer update 

存在 composer.json 的任意文件夹。解释器 php.exe 已在 PATH 变量中。



任何线索?

解决方案

当然。只要将composer.phar放在 C:\ php\composer.phar 之类的地方,然后在PATH中的某个地方创建一个批处理文件 composer.bat 其执行以下操作:

  @ECHO OFF 
php%〜dp0composer.phar %* $ bb



%*重复传递给shell脚本的所有参数。 p>

然后你可以运行 composer update 所有你想要的!


I've read the global installation documentation for Composer, but it's for *nix systems only:

curl -s https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer

I would be such happy doing the same on Windows, that's the OS of my development machine. I would be able to run

composer update

From an arbitrary folder where composer.json exists. Interpreter php.exe is already in PATH variable.

Any clue?

解决方案

Sure. Just put composer.phar somewhere like C:\php\composer.phar, then make a batch file somewhere within the PATH called composer.bat which does the following:

@ECHO OFF
php "%~dp0composer.phar" %*

The "%*" repeats all of the arguments passed to the shell script.

Then you can run around doing composer update all ya want!

这篇关于有没有办法在Windows上全局安装Composer?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆