如何在WampServer中使用作曲家? [英] How to use composer with WampServer?
问题描述
我正尝试在我的 WampServer 中使用composer。
I am trying to use composer with my WampServer.
我所有文件的路径为 C: \wamp64\www
,但是当我运行composer时,它将在其他位置安装供应商文件和其他内容。
My path for all the files is C:\wamp64\www
, but when I run composer it will install the vendor file and other stuff somewhere else.
我什至都不知道在哪里,也无法更改项目在哪里的路径。
我已经尝试了所有方法,但似乎仍未在我的项目文件夹中安装供应商文件。
I don't even know where and I can't change the path of where is my project. I tried everything already and it still dose not seem to install the vendor file in my project folder.
推荐答案
在项目文件夹上运行composer。
Just run composer on your project folder.
说您的项目路径在 C:\wamp64\www\project0
。因此,只需在 project0
文件夹中运行 composer install
。 Composer将在此 project0
文件夹内创建 vendor
文件夹。该文件夹包含一些已安装的库
的文件夹。
Say your project path is on C:\wamp64\www\project0
. So, just run composer install
inside project0
folder. Composer will create vendor
folder inside this project0
folder. This folder contain some folders of installed libraries
.
Composer还会生成文件 composer。锁定
。此文件包含已安装库的信息。
Composer also generate a file composer.lock
. This file contain information of installed libraries.
然后,当您要使用库时,请将此代码添加到php文件中。
Then, when you want to use the libraries, please add this code inside your php file.
require_once "vendor/autoload.php";
这将调用自动加载器,因此您无需使用 require_once
再加载 PHP Classess
。只需使用 use
关键字调用 Class
。
This will call autoloader, so you don't need to use require_once
anymore to load PHP Classess
. Just call the Class
using use
keyword.
use Library0/Class0;
use Library1/Class1;
use Library2/Class2;
这篇关于如何在WampServer中使用作曲家?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!