Is there some public mirror for composer packages?

479 views Asked by At

My company's IPs range seems to be blocked by packagist.org's hosting service and I can't reach that domain. I've already contacted them but I don't know how much long it will take to remove the blockage. Moreover, every external web proxy I try to use falls into my company's firewall so I'm stuck.

Is there any public mirror for composer packages so I don't have to depend on packagist.org domain?

Any other solution is welcome as well.

2

There are 2 answers

1
Phellipe Ribeiro On BEST ANSWER

I couldn't find a public mirror but I was able to solve packagist.org dependency by editing ~/.composer/config.json and adding dependent projects' GitHub links as repositories, eg:

{
    "repositories": [
        { "type": "vcs", "url": "https://github.com/smarty-php/smarty" },
        { "type": "vcs", "url": "https://github.com/sebastianbergmann/phpunit" },
        { "type": "vcs", "url": "https://github.com/sebastianbergmann/php-code-coverage" },
        { "type": "vcs", "url": "https://github.com/sebastianbergmann/php-file-iterator" },
        { "type": "vcs", "url": "https://github.com/sebastianbergmann/php-text-template" },
        { "type": "vcs", "url": "https://github.com/sebastianbergmann/php-timer" },
        { "type": "vcs", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects" },
        { "type": "vcs", "url": "https://github.com/phpspec/prophecy" },
        ...
        { "packagist": false }
    ]
}

The drawback is pretty obvious: I had to map every dependency and dependency's dependencies and point out theirs GitHub link. At least it's been faster to do this than to wait for OVH hosting service to solve the blockage problem.

1
Sven On

The team responsible for packagist.org states that they don't block anyone within their server. They cannot vouch for the hosting company though.

There is no mirror server that I know of. Are you positively sure that this isn't an issue with your firewall? If you say that you cannot use public proxies because of it, I would say that it might block too much.

On the other side, relying on certain external servers to be up when you need them probably is an expectation that cannot be met all the time. This isn't just packagist.org, but all other hosting web servers with the software you want, like Github, Bitbucket etc. I'd say this would be an ideal opportunity to start creating a local copy for you, but of course this would need a working first time contact with packagist.org.