Space Cat, Prince Among Thieves

Require a Remote Zip File with Composer

I previously showed you how to Load a Github Gist with Composer, but sometimes you need to install code that isn't isn't even in a public facing VCS.

I for instance wanted to use a library only distributed by Zip.

It's actually fairly easy! In your composer.json file, you simply add a repositories section to the root. You will want to update the url section to point at the remote zip you intend to load, as well as updating the name and autoload sections. More information on configuring composers autoloader can be found here.

"repositories": [
        "type": "package",
        "package": {
            "name": "dr-que/x-y",
            "version": "master",
            "dist": {
                "type": "zip",
                "url": "",
                "reference": "master"
            "autoload": {
                "classmap": ["."]

Then in your require section, add your selected name as follows.

"require": {
    "dr-que/x-y": "dev-master"

Then just run composer update and you should be ready to roll!

Comment by: Ed on

Ed GravatarThanks!

P.S. I also tried to include dr-que, but other lib - :)

Email address will never be publicly visible.

See my Tweet about comment formatting.