Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ignore packagist.org on composer install | update

I'm using composer internally for managing internal software dependencies. Our repository server is on our private network and we aren't using any other package from any other repository than ours.

Every time you run

composer.phar [install | update]

It checks on packagist.org repositories after check our own repository. Beyond unnecessary, it takes longer when packagist is slow (or even down) or our internet connection is having a bad day.

Is there any way to tell composer to ignore checking for packagist repositories?

like image 410
taiar Avatar asked Dec 25 '22 17:12

taiar


1 Answers

Yes, and it is even documented on https://getcomposer.org/doc/05-repositories.md#disabling-packagist-org

You may try to use this command:

$ composer config repositories.packagist false

You probably want to have a look at Satis: http://getcomposer.org/doc/articles/handling-private-packages-with-satis.md

It will make your life easier if you deal with a bit more of local/private packages, because otherwise you'd have to mention EVERY repository that might host required code. And you can use Satis to grab a copy of the versions into a ZIP file that can be hosted locally as well. See http://www.naderman.de/slippy/src/?file=2012-11-22-You-Thought-Composer-Couldnt-Do-That.html#13 for some hints of how to do it (press cursor keys left/right to skip through the presentation)

For extra bonus points, you'd add packagist.org as a Composer repository to Satis, require some needed packages, and set { "require-dependencies": true } to grab their dependencies as well. In your own code, you'd only set your Satis repository and disable Packagist.

like image 86
Sven Avatar answered Jan 13 '23 15:01

Sven