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 安装路径?
基础教程推荐
- 学说 dbal querybuilder 作为准备好的语句 2022-01-01
- PHP PDO MySQL 查询 LIKE ->多个关键词 2021-01-01
- PHP 类:全局变量作为类中的属性 2021-01-01
- 如何在 Laravel 中使用 React Router? 2022-01-01
- 在PHP中根据W3C规范Unicode 2022-01-01
- Cron Jobs 调用带有变量的 PHP 脚本 2022-01-01
- 有什么方法可以用编码 UTF-8 而不是 Unicode 返回 PHP`json_encode`? 2021-01-01
- YouTube API v3 点赞视频,但计数器不增加 2022-01-01
- 如何替换eregi() 2022-01-01
- 如何在 Laravel 5.3 注册中添加动态下拉列表列? 2021-01-01
