我可以从GitHub为作曲家包设置备用供应商目标文件夹路径吗?

时间:2016-07-23 16:29:04

标签: git composer-php

我正在尝试从我们拥有私有存储库的GitHub中提取一个包,但是我想在需要时更改“vendor / package”文件夹名称 - 即因为:

  1. 我们无法将我们的官方公司名称作为我们的GitHub帐户
  2. 因为我们不是通过作曲家,我们用带有前缀的名字来命名我们的包裹以试图让它们井然有序
  3. PEAR有一个vendor-alias键,Git似乎没有,但实质上,我想知道这样的事情是否可行:

    composer.json:

    "require": {
        "timeslice/common": "~1.0"
    },
    "repositories": [
        {
            "type": "vcs",
            "url":  "git@github.com:timeslicelive/kiosk-common.git",
            "vendor-alias": "timeslice/common"
        }
    ]
    

    安装路径:

    /vendor/timeslice/common/
    

1 个答案:

答案 0 :(得分:0)

我遇到了同样的问题,一个支持laravel 5.2的包,我有laravel 5.3。

当然作曲家会抛出依赖错误:

Problem 1
  - Conclusion: don't install laravel/framework v5.3.19
...
  - pqb/filemanager-laravel 2.0.7 requires illuminate/support 5.0.*|5.1.*|5.2.*

软件包作者尚未更新到laravel 5.3,并且关于更新的github问题消息大约一个月没有响应。 我找到了一个github fork,它被更新以支持laravel 5.3,所以我需要让作曲家使用原始包名,但要安装源代码的分叉更新版本。

oudate repo是:https://github.com/guillermomartinez/filemanager-laravel

更新后的回购邮件是:https://github.com/LuaxY/filemanager-laravel

https://packagist.org的包裹是:https://packagist.org/packages/pqb/filemanager-laravel

所以,我希望在pqb/filemanager-laravel中有一个包含更新的LuaxY/filemanager-laravel github repo源代码的包。

packagerepositories)中定义的composer.json类型为我工作:

注意:为了自动加载包,您需要指定包的自动加载目录。它可以是srcdist甚至是其他内容。您应该始终检查repo目录结构。

"repositories": [
    {
        "type": "package",
        "package": {
            "name": "pqb/filemanager-laravel",
            "version": "2.0.7",
            "dist": {
                "url": "https://github.com/LuaxY/filemanager-laravel/archive/5.3.zip",
                "type": "zip"
            },
            "source": {
                "url": "https://github.com/LuaxY/filemanager-laravel.git",
                "type": "git",
                "reference": "pqb/filemanager-laravel"
            },
            "autoload": {
                "classmap": ["src"]
            }
        }
    }
]

在require部分中我们包含原始包:

"require" : {
    "pqb/filemanager-laravel": "^2.0.7"
}

然后我做了一个composer update,我从github repo安装了包,没有依赖错误:

enter image description here

相关问题