[英]Using Composer to Install My Own Application
Is there a way to get composer to download my application into my root folder? 有没有办法让作曲家将我的应用程序下载到我的根文件夹中?
I'd like users to be able to run the following in their docroot: 我希望用户能够在其docroot中运行以下命令:
composer require name/package
And have that download all my application files to the docroot, then install dependencies into vendor via the composer.json file. 然后将所有我的应用程序文件下载到docroot,然后通过composer.json文件将依赖项安装到供应商中。
composer install
Is this even possible? 这有可能吗?
I thought I could use the repositories
directive in the composer.json
but it still installs all my files into vendor
我以为可以在
composer.json
使用repositories
指令,但是它仍然会将我所有的文件安装到vendor
My composer.json looks like so: 我的composer.json看起来像这样:
{
"name": "username/package",
"description": "My App Description",
"require": {
"php": ">=5.5.0",
"raven/raven": "0.11.0",
"filp/whoops": "~1.0",
"robmorgan/phinx": "*",
"swiftmailer/swiftmailer": "@stable"
},
"minimum-stability": "dev"
}
Any way to add my package and have it install where I want? 有什么方法可以添加我的软件包并将其安装在我想要的位置吗?
Ok I found the answer: create-project
好吧,我找到了答案:
create-project
composer create-project name/package public_html --stability="dev"
This will create the public_html directory and download all the dependencies. 这将创建public_html目录并下载所有依赖项。
Perfect. 完善。
Move your composer.json
at the root of your package. 将您的
composer.json
移动到包的根目录。 Then, simply create a git repository ensuring the composer.json
is in the root, and push it to a service such as github. 然后,只需创建一个git存储库,确保
composer.json
在根目录中,然后将其推送到诸如github之类的服务即可。
Visit: https://packagist.org/packages/submit (sign in required) and paste your git url in the Repository URL
field. 请访问: https : //packagist.org/packages/submit (需要登录),然后将您的git url粘贴到“
Repository URL
字段中。
Please ensure that you follow the Composer naming conventions 请确保您遵循Composer命名约定
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.