How do you get composer to install a non-composer package?

Xeoncross picture Xeoncross · May 31, 2013 · Viewed 9.4k times · Source

I am trying to get composer to download the following library from this project, however, it does not have a composer.json file in it so I'm not sure if this is possible.

{
    "require" : {
        "fguillot/picoFeed" : "*"
    },
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/fguillot/picoFeed"
        }
    ]
}

Error:

[Composer\Repository\InvalidRepositoryException]
No valid composer.json was found in any branch or tag of https://github.com/fguillot/picoFeed, could not load a package from it.

Answer

George picture George · Jun 1, 2013

To include a non composer repository you need to set up a package repository. Which would give you something like:

{
    "repositories": [
        {
            "type": "package",
            "package": {
                "name": "fguillot/picoFeed",
                "version": "dev-master",
                "source": {
                    "url": "https://github.com/fguillot/picoFeed",
                    "type": "git",
                    "reference": "origin/master"
                }
            }
        }
    ],
    "require": {
        "fguillot/picoFeed": "dev-master"
    }
}