简体   繁体   English

Composer安装软件包的依赖关系

[英]Composer Install Package Dependencies

I have created a custom package which is set up in a GIT repo. 我创建了一个自定义程序包,该程序包在GIT存储库中设置。 Composer is successfully pulling the files into a directory in the vendor directory, but I need to pull in the nested dependencies, which I cannot find the answer on how to make this happy. Composer已成功将文件拉到供应商目录中的目录中,但是我需要拉入嵌套的依赖项,但我找不到如何使之满意的答案。

This the Composer file for the main site pulling the package: 这是主站点提取包的Composer文件:

{
    "name": "development/project",
    "type" : "project",
    "repositories": [
        {
            "type":"composer",
            "url":"https://wpackagist.org"
        },
       {
           "type": "package",
           "package": {
               "name": "development/package",
               "version": "0.0.1",
               "source": {
                   "type": "git",
                   "url": "https://developer@bitbucket.org/development/package.git",
                   "reference" : "v0.0.1"
               }
           }
        },
     ],

     "require": {
         "php": ">=5.4",
         "composer/installers": "~1.0",
     },

     "require-dev": {
         "development/package": "~0.0"
    }
}

And here is the Composer file local to the package itself: 这是包本身本地的Composer文件:

{
  "name": "development/package",
  "type" : "project",

  "require": {
    "php": ">=5.4",
    "composer/installers": "~1.0"
  },

  "require": {
    "ellislab/codeigniter": "~3.0"
  },
}

So what I would like to have happen is that when I run Composer on the main site it pulls in the 'development/package' (which it is currently doing), but also pull in the package dependencies 'ellislab/codeigniter'. 因此,我想发生的事情是,当我在主站点上运行Composer时,它会提取“开发/程序包”(当前正在执行),但还会提取程序包依赖项“ ellislab / codeigniter”。 Thanks for any help on this. 感谢您对此的任何帮助。

You have invalid composer json in your local package, it should be like this (no double require node): 您的本地软件包中包含无效的composer json,它应该是这样的(没有双重require节点):

{
  "name": "development/package",
  "type" : "project",

  "require": {
    "php": ">=5.4",
    "composer/installers": "~1.0",
    "ellislab/codeigniter": "~3.0"
  }
}

Composer automatically pulls all packages defined in require node of root package, and in require node of each dependent packages, including your ellislab/codeigniter in your development/package . Composer会自动提取在根软件包的require节点以及每个从属软件包的require节点中定义的所有软件包,包括您的development/package ellislab/codeigniter

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM