Is there any way to install Composer globally on Windows?(有没有办法在 Windows 上全局安装 Composer?)
问题描述
我已阅读 Composer 的全局安装文档,但它仅适用于 *nix 系统:
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
我会很高兴在 Windows 上做同样的事情,那是我开发机器的操作系统.我可以跑
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
来自 composer.json 所在的任意文件夹.解释器 php.exe 已经在 PATH 变量中.
From an arbitrary folder where composer.json exists. Interpreter php.exe is already in PATH variable.
有什么线索吗?
推荐答案
当然.只需将 composer.phar 放在 C:phpcomposer.phar 之类的地方,然后在 PATH 中的某个地方创建一个名为 composer.bat 的批处理文件,该文件执行以下操作:
Sure. Just put composer.phar somewhere like C:phpcomposer.phar, then make a batch file somewhere within the PATH called composer.bat which does the following:
@ECHO OFF
php "%~dp0composer.phar" %*
%*"重复传递给 shell 脚本的所有参数.
The "%*" repeats all of the arguments passed to the shell script.
然后你就可以到处乱跑composer update了!
Then you can run around doing composer update all ya want!
这篇关于有没有办法在 Windows 上全局安装 Composer?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:有没有办法在 Windows 上全局安装 Composer?
基础教程推荐
- 如何在 Laravel 中使用 React Router? 2022-01-01
- 学说 dbal querybuilder 作为准备好的语句 2022-01-01
- PHP 类:全局变量作为类中的属性 2021-01-01
- 有什么方法可以用编码 UTF-8 而不是 Unicode 返回 PHP`json_encode`? 2021-01-01
- YouTube API v3 点赞视频,但计数器不增加 2022-01-01
- 如何替换eregi() 2022-01-01
- PHP PDO MySQL 查询 LIKE ->多个关键词 2021-01-01
- 如何在 Laravel 5.3 注册中添加动态下拉列表列? 2021-01-01
- Cron Jobs 调用带有变量的 PHP 脚本 2022-01-01
- 在PHP中根据W3C规范Unicode 2022-01-01
