2
votes

I've got some composer.json files that contain sections like this:

"repositories": [
    {
        "type": "vcs",
        "url": "http://svn.example.com/libs/",
        "package-path": "Package1"
    },
    {
        "type": "vcs",
        "url": "http://svn.example.com/libs/",
        "package-path": "Package2"
    },
    {
        "type": "vcs",
        "url": "http://svn.example.com/libs/",
        "package-path": "Package3"
    }
],

"require": {
    "ident/Package1": "~2.0",
    "ident/Package2": "~3.0",
    "ident/Package3": "~1.0"
}

That is, the individual packages are in subdirectories beneath the ../trunk directory in Subversion, instead of their own project directories with the standard ./[trunk,tags,branches] arrangement.

Is there a way to optimize this composer.json so as not to have to repeat the VCS type and url values when only the package-path changes? Assume that I cannot change the Subversion directory layout, but just about anything else would be possible.

1

1 Answers

2
votes

I cannot think of a way to optimize this.

The real potential for optimization is on a completely different level: The way you are adding private repositories requires you to always add every one of them to the root composer.json file even if the packages are not directly included there.

This is a lot of maintenance work. It would be better if you can for example use Satis to create a local package repository and only add this single info everywhere. Using Satis, you will then only add your private repositories once - and then it doesn't really matter whether or not you repeat a URL. Adding new packages will only be done once in the Satis configuration, and then be available everywhere.