0% found this document useful (0 votes)
175 views16 pages

Magento2 Composer Installation Guide

This document provides instructions for installing and upgrading Magento 2 using Composer. It outlines how to install Magento 2 with Composer by running composer create-project and specifying the repository URL, project name, installation directory, and version. It also describes validating authentication keys, handling authentication in the auth.json file, and performing upgrades by changing the version in composer.json, running composer update with the --dry-run flag, and following pre and post upgrade checklists.

Uploaded by

Venkat Vemuri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
175 views16 pages

Magento2 Composer Installation Guide

This document provides instructions for installing and upgrading Magento 2 using Composer. It outlines how to install Magento 2 with Composer by running composer create-project and specifying the repository URL, project name, installation directory, and version. It also describes validating authentication keys, handling authentication in the auth.json file, and performing upgrades by changing the version in composer.json, running composer update with the --dry-run flag, and following pre and post upgrade checklists.

Uploaded by

Venkat Vemuri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Composer with Magento2 Training

01 - Installing Magento2 with Composer (using composer create-project)

composer create-project --repository-url=[Link] <project name>


<installation directory name> <version>

● --repository-url: This is important to be set as the magento packages are not hosted on the
offical packagist. [Link] is the offical magento composer packages
repository
● <project name>: This would be either enterprise or community editions depending upon your
needs.
❍ magento/project-community-edition
❍ magento/project-enterprise-edition
● <installation directory name>: This will be the directory in which the project install will take
place. If a directory with the given name is not present then a directory will be created. If a
directory with the given name already exists make sure its empty orelse composer installation will
throw an error.
● <version>: This parameter only when you might be interested in a specific version of the magento.
When this parameter is not provided the latest stable version of the package is installed.

composer create-project --repository-url=[Link]


magento/project-enterprise-edition magento2ee 2.1.8

composer create-project --repository-url=[Link]


magento/project-community-edition magento2ce 2.1.8

02 - Validating Auth keys for Maganto2 CE and EE installation

curl -u [Public Key]:[Private Key] [Link] | grep


--color="auto" -m 1 -ho "magento\\\\/product-enterprise-edition" | head -1

03 - Handling Composer authentication for Modules


Global V/s Project Specific Authentication ([Link])

[Link] for any composer based project should always be maintained at the project level so that
installation can happen smoothly when setting up a project.

.
├── app
├── [Link] (Maintain's the Authentication Details)
├── bin
├── [Link]
├── [Link]
├── dev
├── [Link] (Maintain's the build task details)
├── [Link] (Maintain's the NPM package details)
├── [Link] (Maintain's any extra PHP setting)
├── [Link] (Maintain's any extra Server setting)
├── [Link]
├── lib
├── phpserver
├── pub
├── setup
├── var
└── vendor

{
"github-oauth": {
"[Link]": "<github-token>"
},
"http-basic": {
"[Link]": {
"username": "<public-key>",
"password": "<private-key>"
}
}
}

Adding a GitHub token:

composer config --auth [Link] <github-token>

Adding Magento Username/Password for CE/EE setup

composer config --auth [Link] <public-key> <private-key>

For a development machine the credentials can be maintained at the global level as
well. --global|-g flag can be used to save/generate the [Link] details at the global
level.

composer config -g store-auths false

03 - Upgrading Magento Version

Upgrade process for Magento2 should always be in start for the local development
envirnoment and should be deployed upstream

Pre-Upgrade Checklist:
● Get the latest DB backup from the LIVE DB
● Read the release note of the latest version (Helps with troubleshooting)

Upgrade Checklist:
● Change the version number in [Link] file

composer require <product> <version> --no-update

Enterprise Edition:

composer require magento/product-enterprise-edition 2.0.13 --no-update

Community Edition:
composer require magento/product-community-edition 2.0.13 --no-update

● Run composer update with the --dry-run flag

composer update --dry-run

1/3:
[Link]
[Link]
2/3:
[Link]
[Link]
3/3:
[Link]
[Link]
Finished: success: 3, skipped: 0, failure: 0, total: 3
Loading composer repositories with package information
Updating dependencies (including require-dev)
Finished: success: 0, skipped: 0, failure: 2, total: 2
Package operations: 1 install, 196 updates, 0 removals
- Updating magento/framework (100.1.2) to magento/framework (100.1.8)
- Updating magento/framework-foreign-key (100.1.1) to
magento/framework-foreign-key (100.1.3)
- Updating magento/framework-message-queue (100.1.1) to
magento/framework-message-queue (100.1.3)
- Updating magento/module-media-storage (100.1.1) to magento/module-media-storage
(100.1.2)
- Updating magento/module-config (100.1.1) to magento/module-config (100.1.5)
- Updating magento/module-backend (100.1.1) to magento/module-backend (100.1.3)
- Updating magento/module-store (100.1.2) to magento/module-store (100.1.6)
- Updating magento/module-user (100.1.1) to magento/module-user (100.1.3)
- Updating magento/module-variable (100.1.1) to magento/module-variable (100.1.2)
- Updating magento/module-ui (100.1.1) to magento/module-ui (100.1.6)
- Updating magento/module-email (100.1.1) to magento/module-email (100.1.4)
- Updating magento/module-require-js (100.1.2) to magento/module-require-js
(100.1.3)
- Updating magento/module-translation (100.1.1) to magento/module-translation
(100.1.3)
- Updating magento/module-directory (100.1.1) to magento/module-directory
(100.1.4)
- Updating magento/module-theme (100.1.2) to magento/module-theme (100.1.6)
- Updating magento/module-authorization (100.1.1) to magento/module-authorization
(100.1.2)
- Updating magento/module-eav (100.1.2) to magento/module-eav (100.1.6)
- Updating magento/module-catalog (101.0.2) to magento/module-catalog (101.0.8)
- Updating magento/module-quote (100.1.2) to magento/module-quote (100.1.5)
- Updating magento/module-catalog-inventory (100.1.2) to
magento/module-catalog-inventory (100.1.6)
- Updating magento/module-page-cache (100.1.1) to magento/module-page-cache
(100.1.3)
- Updating magento/module-url-rewrite (100.1.1) to magento/module-url-rewrite
(100.1.3)
- Updating magento/module-cms-url-rewrite (100.1.1) to
magento/module-cms-url-rewrite (100.1.2)
- Updating magento/module-cms (101.0.2) to magento/module-cms (101.0.6)
- Updating magento/module-catalog-url-rewrite (100.1.1) to
magento/module-catalog-url-rewrite (100.1.4)
- Updating magento/module-import-export (100.1.1) to magento/module-import-export
(100.1.4)
- Updating magento/module-security (100.1.1) to magento/module-security (100.1.3)
- Updating magento/module-customer (100.1.2) to magento/module-customer (100.1.7)
- Updating magento/module-integration (100.1.1) to magento/module-integration
(100.1.4)
- Updating magento/module-tax (100.1.1) to magento/module-tax (100.1.3)
- Updating magento/module-widget (100.1.1) to magento/module-widget (100.1.4)
- Updating magento/module-sales-rule (100.1.1) to magento/module-sales-rule
(100.1.4)
- Updating magento/module-reports (100.1.1) to magento/module-reports (100.1.4)
- Updating magento/module-catalog-rule (100.1.2) to magento/module-catalog-rule
(100.1.4)
- Updating magento/module-grouped-product (100.1.2) to
magento/module-grouped-product (100.1.4)
- Updating magento/module-msrp (100.1.1) to magento/module-msrp (100.1.3)
- Updating magento/module-rule (100.1.1) to magento/module-rule (100.1.5)
- Updating magento/module-wishlist (100.1.2) to magento/module-wishlist (100.1.5)
- Updating magento/module-shipping (100.1.1) to magento/module-shipping (100.1.3)
- Updating magento/module-checkout (100.1.2) to magento/module-checkout (100.1.7)
- Updating magento/module-payment (100.1.2) to magento/module-payment (100.1.6)
- Updating magento/module-sales (100.1.2) to magento/module-sales (100.1.7)
- Updating magento/module-gift-message (100.1.1) to magento/module-gift-message
(100.1.4)
- Updating magento/module-sales-sequence (100.1.1) to
magento/module-sales-sequence (100.1.3)
- Updating magento/module-rss (100.1.1) to magento/module-rss (100.1.2)
- Updating magento/module-contact (100.1.1) to magento/module-contact (100.1.3)
- Updating magento/module-downloadable (100.1.1) to magento/module-downloadable
(100.1.2)
- Updating magento/module-cron (100.1.1) to magento/module-cron (100.1.3)
- Updating magento/module-newsletter (100.1.1) to magento/module-newsletter
(100.1.3)
- Updating magento/module-review (100.1.1) to magento/module-review (100.1.3)
- Updating magento/module-product-alert (100.1.1) to magento/module-product-alert
(100.1.3)
- Updating magento/module-indexer (100.1.2) to magento/module-indexer (100.1.3)
- Updating magento/module-catalog-import-export (100.1.1) to
magento/module-catalog-import-export (100.1.5)
- Updating magento/module-developer (100.1.1) to magento/module-developer
(100.1.3)
- Updating magento/module-backup (100.1.1) to magento/module-backup (100.1.2)
- Updating magento/module-search (100.1.1) to magento/module-search (100.1.3)
- Updating magento/module-catalog-search (100.1.2) to
magento/module-catalog-search (100.1.6)
- Updating magento/module-staging (100.1.2) to magento/module-staging (100.1.7)
- Updating magento/module-catalog-staging (100.1.2) to
magento/module-catalog-staging (100.1.8)
- Updating magento/module-product-video (100.1.2) to magento/module-product-video
(100.1.5)
- Updating magento/module-product-video-staging (100.1.1) to
magento/module-product-video-staging (100.1.2)
- Updating magento/module-weee-staging (100.1.1) to magento/module-weee-staging
(100.1.2)
- Updating magento/module-rma-staging (100.1.1) to magento/module-rma-staging
(100.1.2)
- Updating magento/module-review-staging (100.1.1) to
magento/module-review-staging (100.1.3)
- Updating magento/module-msrp-staging (100.1.1) to magento/module-msrp-staging
(100.1.2)
- Updating magento/module-google-optimizer-staging (100.1.1) to
magento/module-google-optimizer-staging (100.1.2)
- Updating magento/module-gift-wrapping-staging (100.1.1) to
magento/module-gift-wrapping-staging (100.1.2)
- Updating magento/module-gift-message-staging (100.1.1) to
magento/module-gift-message-staging (100.1.2)
- Updating magento/module-catalog-inventory-staging (100.1.1) to
magento/module-catalog-inventory-staging (100.1.4)
- Updating magento/module-layered-navigation (100.1.1) to
magento/module-layered-navigation (100.1.2)
- Updating magento/module-layered-navigation-staging (100.1.1) to
magento/module-layered-navigation-staging (100.1.2)
- Updating magento/module-search-staging (100.1.1) to
magento/module-search-staging (100.1.2)
- Updating magento/module-sales-rule-staging (100.1.2) to
magento/module-sales-rule-staging (100.1.6)
- Updating magento/module-catalog-rule-staging (100.1.2) to
magento/module-catalog-rule-staging (100.1.4)
- Updating magento/module-advanced-search (100.1.1) to
magento/module-advanced-search (100.1.2)
- Updating magento/module-elasticsearch (100.1.1) to magento/module-elasticsearch
(100.1.4)
- Updating magento/module-resource-connections (100.1.1) to
magento/module-resource-connections (100.1.2)
- Updating magento/module-website-restriction (100.1.1) to
magento/module-website-restriction (100.1.2)
- Updating magento/module-visual-merchandiser (100.1.1) to
magento/module-visual-merchandiser (100.1.5)
- Updating magento/module-versions-cms (100.1.1) to magento/module-versions-cms
(100.1.3)
- Updating magento/module-advanced-rule (100.1.1) to magento/module-advanced-rule
(100.1.2)
- Updating magento/module-customer-segment (100.1.1) to
magento/module-customer-segment (100.1.3)
- Updating magento/module-target-rule (100.1.2) to magento/module-target-rule
(100.1.6)
- Updating magento/module-scheduled-import-export (100.1.1) to
magento/module-scheduled-import-export (100.1.3)
- Updating magento/module-scalable-oms (100.1.1) to magento/module-scalable-oms
(100.1.3)
- Updating magento/module-scalable-inventory (100.1.1) to
magento/module-scalable-inventory (100.1.2)
- Updating magento/module-scalable-checkout (100.1.1) to
magento/module-scalable-checkout (100.1.3)
- Updating magento/module-advanced-sales-rule (100.1.1) to
magento/module-advanced-sales-rule (100.1.2)
- Updating magento/module-advanced-catalog (100.1.1) to
magento/module-advanced-catalog (100.1.3)
- Updating magento/module-sales-archive (100.1.1) to magento/module-sales-archive
(100.1.3)
- Updating magento/module-custom-attribute-management (100.1.1) to
magento/module-custom-attribute-management (100.1.2)
- Updating magento/module-customer-custom-attributes (100.1.1) to
magento/module-customer-custom-attributes (100.1.3)
- Updating magento/module-rma (100.1.1) to magento/module-rma (100.1.4)
- Updating magento/module-invitation (100.1.1) to magento/module-invitation
(100.1.2)
- Updating magento/module-reward (100.1.1) to magento/module-reward (100.1.2)
- Updating magento/module-reminder (100.1.1) to magento/module-reminder (100.1.2)
- Updating magento/module-banner (100.1.1) to magento/module-banner (100.1.3)
- Updating magento/module-promotion-permissions (100.1.1) to
magento/module-promotion-permissions (100.1.2)
- Updating magento/module-gift-card (101.0.2) to magento/module-gift-card
(101.0.5)
- Updating magento/module-bundle (100.1.1) to magento/module-bundle (100.1.3)
- Updating magento/module-price-permissions (100.1.1) to
magento/module-price-permissions (100.1.2)
- Updating magento/module-persistent (100.1.1) to magento/module-persistent
(100.1.3)
- Updating magento/module-persistent-history (100.1.1) to
magento/module-persistent-history (100.1.2)
- Updating magento/module-cybersource (100.1.1) to magento/module-cybersource
(100.1.3)
- Updating magento/module-advanced-checkout (100.1.2) to
magento/module-advanced-checkout (100.1.4)
- Updating magento/module-multiple-wishlist (100.1.1) to
magento/module-multiple-wishlist (100.1.2)
- Updating magento/module-logging (100.1.1) to magento/module-logging (100.1.3)
- Updating magento/module-gift-wrapping (100.1.1) to magento/module-gift-wrapping
(100.1.5)
- Updating magento/module-gift-registry (100.1.1) to magento/module-gift-registry
(100.1.2)
- Updating magento/module-gift-card-import-export (100.1.1) to
magento/module-gift-card-import-export (100.1.2)
- Updating magento/module-customer-balance (100.1.1) to
magento/module-customer-balance (100.1.2)
- Updating magento/module-gift-card-account (100.1.1) to
magento/module-gift-card-account (100.1.3)
- Updating magento/module-gift-card-staging (100.1.1) to
magento/module-gift-card-staging (100.1.3)
- Updating magento/module-catalog-permissions (100.1.1) to
magento/module-catalog-permissions (100.1.2)
- Updating magento/module-catalog-event (100.1.1) to magento/module-catalog-event
(100.1.2)
- Updating magento/module-enterprise (100.1.1) to magento/module-enterprise
(100.1.2)
- Updating magento/module-customer-import-export (100.1.1) to
magento/module-customer-import-export (100.1.3)
- Updating magento/module-customer-finance (100.1.1) to
magento/module-customer-finance (100.1.2)
- Updating magento/module-catalog-import-export-staging (100.1.1) to
magento/module-catalog-import-export-staging (100.1.2)
- Updating magento/module-banner-customer-segment (100.1.1) to
magento/module-banner-customer-segment (100.1.2)
- Updating magento/module-checkout-agreements (100.1.1) to
magento/module-checkout-agreements (100.1.2)
- Updating magento/module-admin-gws (100.1.1) to magento/module-admin-gws
(100.1.4)
- Updating magento/module-cookie (100.1.1) to magento/module-cookie (100.1.2)
- Updating magento/module-google-analytics (100.1.1) to
magento/module-google-analytics (100.1.2)
- Updating magento/module-google-tag-manager (100.1.1) to
magento/module-google-tag-manager (100.1.3)
- Updating magento/module-eway (100.1.1) to magento/module-eway (100.1.3)
- Updating magento/module-mysql-mq (100.1.1) to magento/module-mysql-mq (100.1.3)
- Updating magento/module-message-queue (100.1.1) to magento/module-message-queue
(100.1.3)
- Updating magento/module-solr (100.1.1) to magento/module-solr (100.1.3)
- Updating magento/module-support (100.1.1) to magento/module-support (100.1.4)
- Updating magento/module-payment-staging (100.1.1) to
magento/module-payment-staging (100.1.3)
- Updating magento/module-grouped-product-staging (100.1.1) to
magento/module-grouped-product-staging (100.1.3)
- Updating magento/module-downloadable-staging (100.1.1) to
magento/module-downloadable-staging (100.1.2)
- Updating magento/module-configurable-product (100.1.2) to
magento/module-configurable-product (100.1.8)
- Updating magento/module-configurable-product-staging (100.1.1) to
magento/module-configurable-product-staging (100.1.3)
- Updating magento/module-cms-staging (100.1.2) to magento/module-cms-staging
(100.1.5)
- Updating magento/module-checkout-staging (100.1.1) to
magento/module-checkout-staging (100.1.3)
- Updating magento/module-bundle-staging (100.1.1) to
magento/module-bundle-staging (100.1.3)
- Updating magento/module-catalog-url-rewrite-staging (100.1.1) to
magento/module-catalog-url-rewrite-staging (100.1.2)
- Updating magento/module-worldpay (100.1.1) to magento/module-worldpay (100.1.3)
- Updating magento/module-amqp (100.1.1) to magento/module-amqp (100.1.2)
- Updating magento/zendframework1 (1.12.16) to magento/zendframework1
(1.12.16-patch3)
- Updating colinmollenhour/php-redis-session-abstract (v1.1) to
colinmollenhour/php-redis-session-abstract (v1.2)
- Updating magento/language-zh_hans_cn (100.1.0) to magento/language-zh_hans_cn
(100.1.1)
- Updating magento/language-pt_br (100.1.0) to magento/language-pt_br (100.1.1)
- Updating magento/language-nl_nl (100.1.0) to magento/language-nl_nl (100.1.1)
- Updating magento/language-fr_fr (100.1.0) to magento/language-fr_fr (100.1.1)
- Updating magento/language-es_es (100.1.0) to magento/language-es_es (100.1.1)
- Updating magento/language-en_us (100.1.0) to magento/language-en_us (100.1.1)
- Updating magento/language-de_de (100.1.0) to magento/language-de_de (100.1.1)
- Updating magento/theme-frontend-blank (100.1.1) to magento/theme-frontend-blank
(100.1.6)
- Updating magento/theme-frontend-luma (100.1.1) to magento/theme-frontend-luma
(100.1.7)
- Updating magento/theme-adminhtml-backend (100.1.1) to
magento/theme-adminhtml-backend (100.1.2)
- Updating magento/module-weee (100.1.1) to magento/module-weee (100.1.2)
- Updating magento/module-webapi (100.1.1) to magento/module-webapi (100.1.4)
- Updating magento/module-webapi-security (100.1.1) to
magento/module-webapi-security (100.1.2)
- Updating magento/module-version (100.1.1) to magento/module-version (100.1.2)
- Updating magento/module-vault (100.1.1) to magento/module-vault (100.2.2)
- Updating magento/module-usps (100.1.1) to magento/module-usps (100.1.3)
- Updating magento/module-ups (100.1.1) to magento/module-ups (100.1.4)
- Updating magento/module-tax-import-export (100.1.1) to
magento/module-tax-import-export (100.1.2)
- Updating magento/module-swatches-layered-navigation (100.1.1) to
magento/module-swatches-layered-navigation (100.1.2)
- Updating magento/module-swatches (100.1.1) to magento/module-swatches (100.1.7)
- Updating magento/module-swagger (100.1.1) to magento/module-swagger (100.1.2)
- Updating magento/module-sitemap (100.1.1) to magento/module-sitemap (100.1.4)
- Updating magento/module-send-friend (100.1.1) to magento/module-send-friend
(100.1.2)
- Updating magento/module-sample-data (100.1.1) to magento/module-sample-data
(100.1.3)
- Installing magento/module-sales-inventory (100.1.1)
- Updating magento/module-paypal (100.1.1) to magento/module-paypal (100.1.6)
- Updating magento/module-offline-shipping (100.1.1) to
magento/module-offline-shipping (100.1.3)
- Updating magento/module-offline-payments (100.1.1) to
magento/module-offline-payments (100.1.2)
- Updating magento/module-new-relic-reporting (100.1.1) to
magento/module-new-relic-reporting (100.1.3)
- Updating magento/module-multishipping (100.1.1) to magento/module-multishipping
(100.1.2)
- Updating magento/module-grouped-import-export (100.1.1) to
magento/module-grouped-import-export (100.1.2)
- Updating magento/module-google-optimizer (100.1.1) to
magento/module-google-optimizer (100.1.2)
- Updating magento/module-google-adwords (100.1.1) to
magento/module-google-adwords (100.1.2)
- Updating magento/module-fedex (100.1.1) to magento/module-fedex (100.1.3)
- Updating magento/module-encryption-key (100.1.1) to
magento/module-encryption-key (100.1.2)
- Updating magento/module-downloadable-import-export (100.1.1) to
magento/module-downloadable-import-export (100.1.2)
- Updating magento/module-dhl (100.1.1) to magento/module-dhl (100.1.3)
- Updating magento/module-deploy (100.1.2) to magento/module-deploy (100.1.5)
- Updating magento/module-currency-symbol (100.1.1) to
magento/module-currency-symbol (100.1.2)
- Updating magento/module-configurable-import-export (100.1.1) to
magento/module-configurable-import-export (100.1.3)
- Updating magento/module-catalog-widget (100.1.1) to
magento/module-catalog-widget (100.1.3)
- Updating magento/module-catalog-rule-configurable (100.1.2) to
magento/module-catalog-rule-configurable (100.1.3)
- Updating magento/module-captcha (100.1.1) to magento/module-captcha (100.1.3)
- Updating magento/module-cache-invalidate (100.1.1) to
magento/module-cache-invalidate (100.1.3)
- Updating magento/module-bundle-import-export (100.1.1) to
magento/module-bundle-import-export (100.1.3)
- Updating magento/module-braintree (100.1.2) to magento/module-braintree
(100.1.6)
- Updating magento/module-authorizenet (100.1.2) to magento/module-authorizenet
(100.1.5)
- Updating magento/module-advanced-pricing-import-export (100.1.1) to
magento/module-advanced-pricing-import-export (100.1.3)
- Updating magento/module-admin-notification (100.1.1) to
magento/module-admin-notification (100.1.2)
- Updating magento/module-marketplace (100.1.1) to magento/module-marketplace
(100.1.2)
- Updating magento/magento2-base (2.1.2) to magento/magento2-base (2.1.8)
- Updating magento/product-community-edition (2.1.2) to
magento/product-community-edition (2.1.8)
- Updating magento/magento2-ee-base (2.1.2) to magento/magento2-ee-base (2.1.8)
- Updating magento/product-enterprise-edition (2.1.2) to
magento/product-enterprise-edition (2.1.8)
Package fabpot/php-cs-fixer is abandoned, you should avoid using it. Use
friendsofphp/php-cs-fixer instead.

● Gather the information of the modules which will be effected by this update
● Run composer update
● Clear out the magento cache and related folders:

rm -rf ./var/cache/* ./var/page_cache/* ./var/view_preprocessed/*


./var/generation/*

● If any external cache system's like **REDIS- or **Varnish- have been implemented then
cache:clean and cache:flush commands also needs to be executed:

php bin/magento cache:clean


php bin/magento cache:flush

├── cache
├── composer_home
├── generation
├── log
├── import
├── page_cache
├── tmp
└── view_preprocessed

● Run the Upgrade script

php bin/magento setup:upgrade

● Run DI Compile

php bin/magento setup:di:compile

● Execute Static Content Deploy

rm -rf pub/static/*
php bin/magento setup:static-content:deploy

● Run Full Indexing (if possible):

php bin/magento indexer:reindex


Post-Upgrade Checklist:
● Check for all overwrites using <preference/>
● Check for theme level template overwrites for *.phtml *.html
● Check for deprecated methods
● Regenerate the Varnish .vcl files and re-configure Varnish
● Make sure the latest changes in [Link] or .[Link] are merged with current
webserver configuration (NGINX or HTTPD or APACHE)
● Full text search feeds needs to be reindexed (Elasticsearch or Solr).

04 - Installing Magento2 modules with Composer


Packgist Modules:

Make sure that the packages are available on the Packgist website search

composer require <package_name>

composer require staempfli/magento2-module-spreadsheet

GitHub Modules:

● If the Github repository no registered on the Packgist website then the repository needs to be
registered to the [Link] file

composer config repositories.<unique-repo-name> <vcs-type> <vcs-url-https-or-ssh>

composer config [Link]-magento2-custom-shipping git


[Link]

● Following snippet gets added to the [Link] file.

{
...
"repositories": {
"magesycho-magento2-custom-shipping": {
"type": "git",
"url": "[Link]
}
}
}
● Finally composer require can be used to download the module

composer require magepsycho/magento2-custom-shipping

05 - Magento2 developer tools with composer require-dev


Sometimes the module we need is just for profiling or debugging purposes.

composer require msp/devtools --dev

07 - Deployment using composer and best pratices


● --no-dev flag should always be used in non development envirnoment setup
● composer install should be triggered on every deployment
● composer update **should never*- be trigger on any non development envirnoment
● --optimize-autoloader should be used to generate optimized autoloader files

composer install --verbose --prefer-dist --no-progress --no-interaction --no-dev


--optimize-autoloader

08 - Magento 2 Composer Modules:


Usage

In the component's [Link], specify:

● type, type of Magento 2 component.


● extra/map, list of files to move and their paths relative to the Magento root directory.
● extra/chmod, list of permissions that should be set for [Link]:
❍ extra/map is required only if your component needs to be moved to a location other than
<Magento root>/vendor. Otherwise, omit this section.
❍ extra/chmod is required only if you need to set specific permissions for files.

Supported Components

The following list explains the use of type in [Link].

Magento Module

"type": "magento2-module"

Installation location: Default vendor directory or as defined in extra/map

Example:
{
"name": "magento/module-core",
"description": "N/A",
"require": {
...
},
"type": "magento2-module",
"extra": {
"map": [
[
"*",
"Magento/Core"
]
]
}
}

Final location is <magento root>/app/code/Magento/Core

Magento Theme

"type": "magento2-theme"

Installation location: app/design

Example:

{
"name": "magento/theme-frontend-luma",
"description": "N/A",
"require": {
...
},
"type": "magento2-theme",
"extra": {
"map": [
[
"*",
"frontend/Magento/luma"
]
]
}
}

Final location is <magento_root>/app/design/frontend/Magento/luma

Magento Language Package

"type": "magento2-language"

Installation location: app/i18n


Example:

{
"name": "magento/language-de_de",
"description": "German (Germany) language",
"require": {
...
},
"type": "magento2-language",
"extra": {
"map": [
[
"*",
"Magento/de_DE"
]
]
}
}

Final location is <magento_root>/app/i18n/Magento/de_DE

Magento Library

"type": "magento2-library"

Support for libraries located in lib/internal instead of in the vendor directory.

Example:

{
"name": "magento/framework",
"description": "N/A",
"require": {
...
},
"type": "magento2-library",
"extra": {
"map": [
[
"*",
"Magento/Framework"
]
]
}
}

Final location is <magento_root>/lib/internal/Magento/Framework

Magento Component

"type": "magento2-component"
Installation location: Magento root directory

Example:

{
"name": "magento/migration-tool",
"description": "N/A",
"require": {
...
},
"type": "magento2-component",
"extra": {
"map": [
[
"*",
"dev/tools/Magento/Tools/Migration"
]
]
}
}

Final location is <magento_root>/dev/tools/Magento/Tools/Migration

Read More here

09 - GIT conventions with Composer workflow


● Always validate your [Link] file before you commit.
● Incase you are not sure which [Link] invalid use:

find ./app/code/ -type f -iname "[Link]" -exec composer validate {} \;

● Incase you messup the vendor directory can be rebuild:

rm -rf ./vendor/*
composer install [--no-dev]

● Always run composer install on every git fetch or keep track on when [Link] got
changed
● Always commit your [Link] and [Link] file on every composer require / composer
remove / composer update

If there are some patches applied you might have to apply them manually.

10 - Patching Magento2
Deploying patches in Magento 2 is very different than what used to do in Magento 1.
● [Link]
● [Link]
● [Link]
● [Link]

Useful Links and Resources:


● A curated list of amazingly awesome PHP libraries, resources and shiny things.
● Security Audit
● Composer CheatSheet
● Composer Plugin List

You might also like