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

1

1

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!

Bakelite answered 1/12, 2014 at 15:57 Comment(0)
S
5

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
Sheela answered 1/12, 2014 at 16:11 Comment(2)
So the answer is yes, Packagist is the only library/repository pre-configured in Composer.Bakelite
@pthurmond Well it depends how you look at it. It is configurable opposed to hard coded, so no I wouldn't say it is native, just default.Sheela

© 2022 - 2024 — McMap. All rights reserved.