Skip to content

Instantly share code, notes, and snippets.

@mttjohnson
Last active April 22, 2021 19:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save mttjohnson/74c33da477e6d5425feedc33a88f4b10 to your computer and use it in GitHub Desktop.
Save mttjohnson/74c33da477e6d5425feedc33a88f4b10 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
# Checking ECE-Tools versions available
[[ ! -f composer.json ]] \
&& echo '{"repositories":[{"packagist.org":false},{"type":"composer","url":"https://repo.magento.com/"}]}' > composer.json \
&& composer info -a magento/ece-tools \
&& rm composer.json
# Checking Enterprise (Commerce) Edition versions available
[[ ! -f composer.json ]] \
&& echo '{"repositories":[{"packagist.org":false},{"type":"composer","url":"https://repo.magento.com/"}]}' > composer.json \
&& composer info -a magento/project-enterprise-edition \
&& rm composer.json
# Checking Commerce Cloud metapackage versions available
[[ ! -f composer.json ]] \
&& echo '{"repositories":[{"packagist.org":false},{"type":"composer","url":"https://repo.magento.com/"}]}' > composer.json \
&& composer info -a magento/magento-cloud-metapackage \
&& rm composer.json
# Compare Magento Editions
brew install php@7.4
echo 'export PATH="/usr/local/opt/php@7.4/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
# Edit /user/local/etc/php/7.4/php.ini to have "memory_limit = 4096M"
# ---- or Alternatively set memory limit on command execution
# echo "memory_limit = 4096M" > .user.ini
# export COMPOSER_MEMORY_LIMIT=-1
# php -dmemory_limit=4096M /usr/local/bin/composer
MAGENTO_REL_VER="2.4.2"
MAGENTO_COMPOSER_PROJECT="magento/project-community-edition"
composer create-project \
--repository-url https://repo.magento.com/ ${MAGENTO_COMPOSER_PROJECT} ./${MAGENTO_REL_VER}_ce ${MAGENTO_REL_VER} \
-s stable \
--no-interaction \
--prefer-dist \
--no-dev
MAGENTO_COMPOSER_PROJECT="magento/project-enterprise-edition"
composer create-project \
--repository-url https://repo.magento.com/ ${MAGENTO_COMPOSER_PROJECT} ./${MAGENTO_REL_VER}_ee ${MAGENTO_REL_VER} \
-s stable \
--no-interaction \
--prefer-dist \
--no-dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment