To prevent Composer from attempting to download the package from the source when the license key is invalid, you can use the preferred-install option in your composer.json file.
Here's how you can configure it:
- Open your
composer.jsonfile. - Add the following line under the
configsection:
"config": {
"preferred-install": {
"*": "dist"
}
}
This configuration tells Composer to prefer downloading packages from the distribution (dist) instead of the source. If a package is not available as a distribution, Composer will fall back to downloading it from the source.
By setting the preferred-install option to "dist", Composer will not attempt to download the package from the source if the download from the distribution fails due to invalid credentials.
Save the composer.json file and run composer update or composer install to apply the changes.
This should prevent Composer from downloading the package from the source when an invalid license key is provided.