composer create-project from private repo

前端 未结 5 1389
醉话见心
醉话见心 2020-12-24 13:56

I have a private project hosted on Bit Bucket. I have an SSH key setup. Is there a way I can use the php composer create-project vendor/name path command in the

5条回答
  •  失恋的感觉
    2020-12-24 14:25

    Yes, Composer allows you to add private projects as 'repositories' to your composer.json file. So therefore you can include private projects into another project.

    It provides support for GitHub and Bitbucket (as well as SVN and Mercurial).

    You need to modify your composer.json file to look something like this:

    {
        "repositories": [ {
            "type": "package",
            "package": {
                "name": "TheShiftExchange/test",
                "version": "1.0.0",
                "source": {
                    "url": "https://github.com/TheShiftExchange/test.git",
                    "type": "git",
                    "reference": "master"
                  }
             }
        }],
        "require": {
            "laravel/framework": "4.0.*",
            "TheShiftExchange/test": "1.0.*"
        },
    }
    

提交回复
热议问题