Jump to content

I'm confused about composer and repositories


entheologist

Recommended Posts

I want to install this package:

https://github.com/composer/installers

from GitHub, I can easily git clone it but I think its better I get experienced with composer. In the readme they onyl give one example, one involving CakePHP:

{
    "name": "you/ftp",
    "type": "cakephp-plugin",
    "require": {
        "composer/installers": "~1.0"
    }
}

but I that isn't much help to me since I'm not making composer.json files to hold a single framework or plugin, my json files look more like this:

{
    "name": "example-app",
    "require": {
        "cakephp/cakephp": ">=2.5.1",
		"cakephp/debug_kit": "2.2.*",
		"slywalker/boost_cake": "*",
		"CakeDC/tags": "1.*",
		"CakeDC/utils": "*",
		"CakeDC/migrations": "*",
		"FriendsOfCake/crud": "*",
		"CakeDC/search": "*",
		"paulredmond/chosen-cakephp": "*"
    },
    "config": {
        "vendor-dir": "Vendor/"
    },
	"extra": {
		"installer-paths": {
			"app/Plugin/Tags": ["CakeDC/tags"],
			"app/Plugin/BoostCake": ["slywalker/boost_cake"]
		}
	}
}

Right now I'm working on a WordPress one and it is 10 times longer than that. So what I was wondering is if its better to split it up into a few composer.json files. As in one file for setting up the framework and configuring it, when its done, it calls a second composer.json file that will take care of installing the plugins. Like this I suppose I could store a bunch of composer.json files in a central location, each of them has a specific purpose, so if I need to use one of them for a project, I just call composer.phar file (which I can access globally), and use that global keywork to make the json file operate like its in my projects directory. I don't understand what this autoload thing is about at all, but its nice the way it lets you run scripts at particular times during the execution of the json file.

 

Is this actually a better way to work with composer, by chaining separate composer.json files together? A big issue is the name conflict thing, is there a way to make composer.phar process files with different names? It be a pain in the ass having to make the scripts alter the filenames. That gets me thinking about something. Can we define variables in composer.json files? If not, I suppose its not very hard to do it anyway by editing the file. I was thinking there that a composer file generator would be pretty useful. Like say on CakePHPs website, theres a page that lets you check plugins and features that you want for your new installation, then it makes a composer.json file for you.

Link to comment
Share on other sites

You can only have one composer.json file per project. Requiring multiple composer.json files makes no sense.

 

What are you trying to do exactly?

 

If you want to install this: https://github.com/composer/installers, you simply need to add "composer/installers": "~1.0" to the "require" section of your existing composer.json file and then run `composer.phar install`

 

Or, you can have composer add the line and install for you all in a single step:

 

composer.phar require 'composer/installers:~1.0'
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.