Paul
Paul

Reputation: 2515

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://[email protected]/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.

Upvotes: 0

Views: 2084

Answers (1)

Rendy Eko Prastiyo
Rendy Eko Prastiyo

Reputation: 1098

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.

Upvotes: 2

Related Questions