简体   繁体   中英

Composer Install Package Dependencies

I have created a custom package which is set up in a GIT repo. 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.

This the Composer file for the main site pulling the package:

{
    "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:

{
  "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'. Thanks for any help on this.

You have invalid composer json in your local package, it should be like this (no double require node):

{
  "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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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