如何在 Windows 上使用作曲家?

2022-01-14 00:00:00 xampp php composer-php

我已经在我的电脑上安装了 xampp.之后我使用窗口安装程序安装了作曲家.在网站上,他们讲述了 composer.json 在示例中看起来像这样

I have installed xampp on my PC. After that I installed composer using window installer. On the website they tell about composer.json which looks something like this in the example

{
"require": {
    "monolog/monolog": "1.2.*"
}
}

我把它放在哪里?我该如何运行它?我搜索了很多,但一无所获.任何建议都会很棒.

Where do I put it? How do I run it? I have searched a lot but found nothing. Any suggestion would be great.

我以管理员身份使用以下命令运行命令提示符

I ran command prompt as administrator with following command

C:windowssystem32>composer

它打印了一堆命令.我试着打字

It printed out a bunch of commands. I tried typing

C:windowssystem32>composer install 

我收到 composer 找不到 composer.json 文件的错误

I got an error that composer could not find composer.json file

推荐答案

好的,假设您的网站位于:

Okay, let's say your website is at:

C:xampphtdocsmywebsite

你应该把 Composer 文件放在:

You should put the Composer file at:

C:xampphtdocsmywebsitecomposer.json

然后,在您的终端中,使用以下两个命令:

Then, in your terminal, use these two commands:

cd C:xampphtdocsmywebsite
composer install

应该是这样的.

您可以使用 Composer 做各种其他事情.找出终端中的 composer 类型.它将显示您可以使用的命令列表.

You can do various other things with Composer. To find out what type composer in your terminal. It will show you a list of commands you can use.

如果您想了解更多关于命令的信息,可以使用 composer help [COMMAND],如下所示:

If you want to know more about a command then you can use composer help [COMMAND], like so:

composer help install

相关文章