使用PHP作曲家克隆git repo [英] Use PHP composer to clone git repo

查看:246
本文介绍了使用PHP作曲家克隆git repo的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用作曲家从github自动复制不在packagist ,但它不工作,我不知道我做错了什么。



我想我必须包括它在存储库之间像这样:

 repositories:[
{
url: https://github.com/l3pp4rd/DoctrineExtensions.git,
type:git
}
],

,然后可能将其列在require部分。它应该类似于此示例,但它不工作。它只是给出这个错误:

 您的需求无法解析为一组可安装的软件包。有没有人尝试这样做这样的东西?

=h2_lin>解决方案

在2013年写作时,这是一种方法。 Composer增加了对更好方法的支持:请参阅@igorw的回答



您有寄存商吗?



Git,Mercurial,SVN由Composer支持。



您是否可以书面访问该协会?



是吗?





如果您的帐户拥有<有一个仓库你可以写入:添加一个 composer.json 文件,或修复现有的,不要使用下面的解决方案。



转到@igorw的回答


$ b $

/ code>,您无法添加



这将覆盖Composer可能会从原始存储库的



使用软件包 type会将正确定义一切的负担转移到你身上。更容易的方法是在存储库中有一个 composer.json 文件,并使用它。



真的只是在罕见的情况下,你有一个废弃的ZIP下载,你不能改变,或者你只能读取,但它不再维护的存储库。

 repositories:[
{
type:package,
package:{
name:l3pp4rd / doctrine-extensions,
version:master,
source:{
url:https://github.com/l3pp4rd/DoctrineExtensions.git ,
type:git,
reference:master
}
}
}
] require:{
l3pp4rd / doctrine-extensions:master
}


I'm trying to use composer to automatically clone a git repository from github that isn't in packagist but it's not working and I can't figure out what am I doing wrong.

I think I have to include it among "repositories" like so:

"repositories": [
    {
        "url": "https://github.com/l3pp4rd/DoctrineExtensions.git",
        "type": "git"
    }
],

and then probably list it in "require" section. It should be similar to this example but it doesn't work. It just gives this error:

Your requirements could not be resolved to an installable set of packages.

Have anyone tried to do something like this already?

解决方案

At the time of writing in 2013 this was one way to do it. Composer has added support for better ways: See @igorw 's answer

DO YOU HAVE A REPOSITORY?

Git, Mercurial, SVN is supported by Composer.

DO YOU HAVE WRITE ACCESS TO THE REPOSITORY?

Yes?

DOES THE REPOSITORY HAVE A composer.json FILE

If you have a repository you can write to: Add a composer.json file, or fix the existing one, and DON'T use the solution below.

Go to @igorw 's answer

ONLY USE THIS IF YOU DON'T HAVE A REPOSITORY
OR IF THE REPOSITORY DOES NOT HAVE A composer.json AND YOU CANNOT ADD IT

This will override everything that Composer may be able to read from the original repository's composer.json, including the dependencies of the package and the autoloading.

Using the package type will transfer the burden of correctly defining everything onto you. The easier way is to have a composer.json file in the repository, and just use it.

This solution really only is for the rare cases where you have an abandoned ZIP download that you cannot alter, or a repository you can only read, but it isn't maintained anymore.

"repositories": [
    {
        "type":"package",
        "package": {
          "name": "l3pp4rd/doctrine-extensions",
          "version":"master",
          "source": {
              "url": "https://github.com/l3pp4rd/DoctrineExtensions.git",
              "type": "git",
              "reference":"master"
            }
        }
    }
],
"require": {
    "l3pp4rd/doctrine-extensions": "master"
}

这篇关于使用PHP作曲家克隆git repo的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆