作曲家的项目结构 [英] Project Structure with composer
问题描述
我正在尝试使用composer-file创建一个项目。
原因主要是我永远都不想上传到git的依赖项。
我的预期结构是:
I'm trying to create a project with composer-file.
Reason is primarily a dependency which I never want to upload to git.
My intended structure is this:
project-root-folder
-project-sub-folder(s)
-供应商(具有require
d个依赖项)
-index.php
-composer.json
-README.md
project-root-folder
- project-sub-folder(s)
- vendor (withrequire
d dependencies)
- index.php
- composer.json
- README.md
但是使用composer安装的结构是:
But the installed structure using composer is this:
项目根文件夹
-供应商
-供应商/撰写者
-供应商/聪明(依赖项)
-供应商/我的项目
-composer.json
project-root-folder
- vendor
- vendor/composer
- vendor/smarty (dependency)
- vendor/my-project
- composer.json
我知道有一些特殊之处安装程序用于许多不同的项目,我只是不了解安装程序是否需要获得预期的结构,如果没有特殊的安装程序,则不需要安装程序。
I know that there are special installers for many different projects, I just don't understand that an installer is required to get the intended structure and also not how to do it without a special installer.
这是一个撰写的内容我尝试过的r文件:
This is the content of one composer file I tried:
{
"name": "wdb/tutorial-oop",
"require": {
"smarty/smarty": "~3.1"
}
}
当我在本地文件中尝试此composer-json内容并仅执行 composer install
时,我得到的结构相同:
When I tried this composer-json content in a local file and just extecute composer install
I get the same structure:
{
"require": {
"wdb/tutorial-oop": "dev-master"
}
}
所以我的问题是,作曲者文件必须如何看待项目结构就像我在此问题顶部描述的那样创建。 基本问题是,我不想将我的项目作为依赖项安装在供应商目录中,而是在项目文件夹的根目录中,而且我不想使用composer自动加载器。
So my question is, how a composer file has to look that the project structure is created like I described in the top of this question. The basic problem is that I don't want my project being installed as dependency in the vendor-directory but in the root of the project folder, and additionally that I don't want to use the composer autoloader.
编辑:
应此处的要求,在项目根目录下提供我完整的作曲家文件:
On request here my full composer file inside the project root:
{
"name": "wdb/tutorial-oop",
"type": "project",
"description": "Your package description goes here",
"keywords": ["oop","mvc","tutorial"],
"homepage": "https://barlians.com",
"license": "GPL-3.0-or-later",
"authors": [
{
"name": "David Bruchmann",
"email": "david.bruchmann@gmail.com",
"homepage": "https://barlians.com",
"role": "Author, Developer"
}
],
"support": {
"email": "david.bruchmann@gmail.com"
},
"require": {
"smarty/smarty": "~3.1"
}
}
推荐答案
您安装的项目不正确。 composer require
命令用于安装依赖项,因此它们将进入 vendor
目录。
You're installing your project in incorrect way. composer require
command is for installing dependencies, so they're go to vendor
directory.
要安装项目,您应该使用 create-project
命令:
For installing project you should use create-project
command:
composer create-project wdb/tutorial-oop
这篇关于作曲家的项目结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!