How to specify Composer install path?(如何指定 Composer 安装路径?)
问题描述
我有这个定义:
{
"repositories": [
{
"type": "package",
"package": {
"name": "symfony/sfGuardPlugin",
"version": "4.0.2",
"dist": {
"url": "http://plugins.symfony-project.org/get/sfGuardPlugin/sfGuardPlugin-4.0.2.tgz",
"type": "tar"
}
}
}
],
"require": {
"symfony/sfGuardPlugin": "4.0.*"
}
}
我正在使用 Symfony 1,我想将它们安装在 plugins/sfGuardPlugin/
上.如何指定?
I am using Symfony 1, and I'd like to install them on plugins/sfGuardPlugin/
. How do I specify this?
推荐答案
看来你可以定义 vendor
目录为 其他东西(你的情况是plugins
):
It seems that you can define the vendor
dir to be something else (plugins
in your case):
{
"config": {
"vendor-dir": "plugins"
}
}
然后,您可以将包名重命名为内部没有级别目录,例如:
Then, you might rename the package name to not have a level dir inside, like:
"package": {
"name": "sfGuardPlugin",
所以,你的 composer.json
应该是这样的:
So, your composer.json
should look like this:
{
"config": {
"vendor-dir": "plugins"
},
"repositories": [
{
"type": "package",
"package": {
"name": "sfGuardPlugin",
"version": "4.0.2",
"dist": {
"url": "http://plugins.symfony-project.org/get/sfGuardPlugin/sfGuardPlugin-4.0.2.tgz",
"type": "tar"
}
}
}
],
"require": {
"sfGuardPlugin": "4.0.*"
}
}
编辑
使用这个配置,你会得到路径(这当然对symfony不好):
Using this configuration, you will get the path (which is of course not good for symfony):
plugins/sfGuardPlugin/sfGuardPlugin-4.0.2/
plugins/sfGuardPlugin/sfGuardPlugin-4.0.2/
我找到了一个使用这个 composer.json
的解决方法:
I found a workaround with this composer.json
:
{
"config": {
"vendor-dir": "plugins"
},
"repositories": [
{
"type": "package",
"package": {
"name": "sfGuardPlugin",
"version": "4.0.2",
"source": {
"url": "http://svn.symfony-project.com/plugins/sfGuardPlugin/",
"type": "svn",
"reference": "branches/1.3/"
}
}
}
],
"require": {
"sfGuardPlugin": "4.0.*"
}
}
这篇关于如何指定 Composer 安装路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何指定 Composer 安装路径?
基础教程推荐
- 在多维数组中查找最大值 2021-01-01
- 超薄框架REST服务两次获得输出 2022-01-01
- 如何在 PHP 中的请求之间持久化对象 2022-01-01
- 通过 PHP SoapClient 请求发送原始 XML 2021-01-01
- mysqli_insert_id 是否有可能在高流量应用程序中返回 2021-01-01
- Libpuzzle 索引数百万张图片? 2022-01-01
- 在 Woocommerce 中根据运输方式和付款方式添加费用 2021-01-01
- XAMPP 服务器不加载 CSS 文件 2022-01-01
- WooCommerce 中选定产品类别的自定义产品价格后缀 2021-01-01
- 在 PHP 中强制下载文件 - 在 Joomla 框架内 2022-01-01