To resolve dependencies from Composer repositories in Artifactory, configure the config.json file to connect the Composer client to Artifactory.
Prerequisite: Before connecting your Composer client to Artifactory, you must have an existing Composer repository in Artifactory. For more information, see Create a Composer Repository.
To connect the Composer client to Artifactory:
Add the following snippet to your
config.jsonfile:{ "repositories": [ { "type": "composer", "url": "https://[JFrogPlatformURL]/artifactory/api/composer/<REPO_NAME>"}, {"packagist": false} ] }Where:
[JFrogPlatformURL]: The URL of your JPD<REPO_NAME>: The name of the target repository
For example:
{ "repositories": [ {"type": "composer", "url": "https://company.jfrog.io/artifactory/api/composer/php-local"}, {"packagist": false} ] }Optionally, if you need to with a non-secure URL like HTTP, add the following snippet to the
config.jsonfile:"config": { "secure-http" : false }To authenticate to Artifactory, add credential snippets to your
auth.jsonfile:{ "http-basic": { "[JFrogPlatformURL]": { "username": "<USERNAME>", "password": "<AUTH>" } } }Where:
[JFrogPlatformURL]: The hostname of your JPD<USERNAME>: Your Artifactory username<AUTH>: Your Artifactory identity token
For example:
{ "http-basic": { "company.jfrog.io": { "username": "jeffry", "password": "51HnvD0A1g2q3n4b5F6g7H8j9K0l1m2N3o4P5q6R7s8T9u0V1w2X3y4" } } }
Note
You can also use JFrog Set me up to copy the snippet populated with your token and environment. For more information, see Use Artifactory Set Me Up for Configuring Package Manager Clients.
Next steps: