Skip to content

Instantly share code, notes, and snippets.

@davidalger
Forked from mttjohnson/composer_private_repos.sh
Created November 24, 2018 23:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidalger/c55503b138cf95ccb16f2b9cd3a09f3e to your computer and use it in GitHub Desktop.
Save davidalger/c55503b138cf95ccb16f2b9cd3a09f3e to your computer and use it in GitHub Desktop.
Composer Notes and Private Repositories
# List the composer home directory
# Typically /Users/<user>/.composer or /home/<user>/.composer or C:\Users\<user>\AppData\Roaming\Composer
echo $COMPOSER_HOME
# List files in the composer home
ls -la $COMPOSER_HOME
# View auth.json in composer home used when no local ./auth.json exists in the directory executed from
cat $COMPOSER_HOME/auth.json
# View config.json in composer home which is merged with any ./composer.json
cat $COMPOSER_HOME/config.json
# List all packages from a private repository only by disabling packagist
# Check for existance of local composer.json and if it does not exist create one
# that will disable packages and specify the repository desired then show all
# packages in that repository and cleanup afterwards by removing the composer.json created
[[ ! -f composer.json ]] \
&& echo '{"repositories":[{"packagist.org":false},{"type":"composer","url":"https://repo.magento.com/"}]}' > composer.json \
&& composer show magento/* --all \
&& rm composer.json
# List package info for a specific package in a private repo
[[ ! -f composer.json ]] \
&& echo '{"repositories":[{"packagist.org":false},{"type":"composer","url":"https://repo.magento.com/"}]}' > composer.json \
&& composer info -a magento/project-community-edition \
&& rm composer.json
# Get package info from packagist (as long as packagist is not disabled and other repositories are not specified)
composer info -a magento/project-community-edition
# When comparing the package info between repositories note the source and distribution url differences
# There may also be version differences between the same package listed in different repositories
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment