Search code examples
composer-php

How to set "canonical: false" when adding a custom repository with the CLI interface?


Is it possible to add canonical: false when adding a repository via CLI, I have searched, but it looks like it has to be manually added?

composer config repositories.test composer https://repo.example.com 

Solution

  • If you need to modify any other option, you can pass a JSON object.

    E.g., in your case it would be something along the lines of:

    composer config repositories.test \
       '{"type": "composer", "url": "https://repo.example.com", "canonical": false}'