Is Packagist the only library/repository of packages that Composer natively pulls from?

余生颓废 提交于 2019-12-24 17:21:13

问题


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


来源:https://stackoverflow.com/questions/27232171/is-packagist-the-only-library-repository-of-packages-that-composer-natively-pull

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!