Set Up Remote Composer Repositories

JFrog Artifactory Documentation

ft:sourceType
Paligo

The public Composer repository does not contain any actual binary packages; it contains the package indexes that point to the corresponding source control repository where the package code is hosted.

Since the majority of public Composer packages are hosted on GitHub, we recommend creating a Composer remote repository to serve as a caching proxy for github.com, specifying packagist.org as the location of the public package index files. A Composer remote repository in Artifactory can proxy packagist.org and other Artifactory Composer repositories for index files, and version control systems such as GitHub or BitBucket, or local Composer repositories in other Artifactory instances for binaries.

Composer artifacts (such as zip, tar.gz files) requested from a remote repository are cached on demand. You can remove the downloaded artifacts from the remote repository cache, however you can not manually deploy artifacts to a remote repository.

To define a remote repository to proxy github.com as well as the public Composer Packagist repository follow the steps below:

  1. From the Administration module, go to Repositories | Repositories | Remote and set PHP Composer to be its Package Type

  2. Set the Repository Key, and enter the repository URL (e.g. https://github.com/) in the URL field as displayed below .

  3. In the Composer Settings section, select GitHub as the Git Provider, and leave the leave the default Registry URL (e.g. https://packagist.org/).

  4. Finally, click Save & Finish.

php_remote_repo.png

URL vs. Registry URL

To avoid confusion:

The URL is the URL of your Git provider where the actual package binaries are hosted.

The Registry URL refers to the URL where the package index files holds the hosted metadata.

To proxy a public Composer registry, set the Registry URL field to the location of the index files as displayed above. To proxy a Composer repository in another Artifactory instance, set both the URL field and the Registry URL field to the remote Artifactory repository's API URL. For example: https://jfrog-art.com/artifactory/api/composer/composer-local.