-->

Is Packagist the only library/repository of packag

2019-08-06 09:52发布

问题:

Is Packagist (https://packagist.org/) the only repository/library of packages that Composer pull from out of the box?

I know that Composer can be configured to point to other libraries of packages, including in-house setups using Satis or other tools. But I am curious if it will scan other libraries, such as Packalyst.

I have been doing a lot of searching and have not found a clear answer to this question. I highly suspect that Packagist is the only library that Composer connects to by default. But I would like to confirm this.

Thanks!

回答1:

Composer is downloaded pre-configured to use packagist.org.

Run: composer config --list --global

To get:

[repositories.packagist.type] composer
[repositories.packagist.url] https?://packagist.org
[repositories.packagist.allow_ssl_downgrade] true

Run: composer config --global repositories.example composer http://example.com

To get:

[repositories.example.type] composer
[repositories.example.url] http://example.com
[repositories.packagist.type] composer
[repositories.packagist.url] https?://packagist.org
[repositories.packagist.allow_ssl_downgrade] true

As you can see, your own package listing site has been added the your copy of composer. Now, when you install packages, it will search both locations for the packages.

You can even remove them. For example to remove the site you just added:

composer config --global --unset repositories.example

Make a backup or be prepared to reinstall composer if you mess it up.
To remove packagist:

composer config --global --unset repositories.packagist