Home > Back-end >  How to use PHP composer and Artifactory remote repository [duplicate]
How to use PHP composer and Artifactory remote repository [duplicate]

Time:09-22

I am using an Artifactory (cloud hosted) remote repository pointing to the Github repo of one of my project dependencies.

I used the Artifactory documentation to set it up and have created the config.json and auth.json files.

The original package is friendsofsymfony/rest-bundle.

I created the repo with the key friendsofsymfony-rest-bundle in Artifactory.

I can't work out what vendor name to use when including the package in composer.json

Here is my composer.json:

{
    "type": "project",
    "license": "proprietary",
    "require": {
        "???/friendsofsymfony-rest-bundle": "^2.6"
    }
}

I am using the "set me up" supplied by Artifactory for the file at ~/.composer/config.json :

{
    "repositories": [{
            "type": "composer",
            "url": "https://mydomain.jfrog.io/artifactory/api/composer/friendsofsymfony-rest-bundle"
        },
        {
            "packagist": false
        }
    ]
}

I have searched for, but can't find an example of how to reference it in composer.json

So the question is: What do I need to change in composer.json to be able to use the Artifactory cached remote repository to pull my dependency into my project?

CodePudding user response:

The package name is defined inside the composer.json of the library (in your friendsofsymfony-rest-bundle repo), not as part of the hosting database. If you haven't edited it, it will still be friendsofsymfony/rest-bundle. That's generally what you want, because you want it to still satisfy the requirements listed in other packages.

Since version 2.0, Composer will treat specifically configured repositories as "canonical" so as soon as it finds the package in your Artifactory repository, it will ignore all versions uploaded to Packagist.org

  • Related