Use PHP composer to clone git repo

后端 未结 8 1160
难免孤独
难免孤独 2020-11-30 16:57

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.

8条回答
  •  北海茫月
    2020-11-30 17:21

    You can include git repository to composer.json like this:

    "repositories": [
    {
        "type": "package",
        "package": {
            "name": "example-package-name", //give package name to anything, must be unique
            "version": "1.0",
            "source": {
                "url": "https://github.com/example-package-name.git", //git url
                "type": "git",
                "reference": "master" //git branch-name
            }
        }
    }],
    "require" : {
      "example-package-name": "1.0"
    }
    

提交回复
热议问题