Install magento 2 module from github using composer is pretty simple. We assume that you already has git and composer installed on your system. Let’s take magento2-configuration-arrayserialized as an example. Complete commands list are:
1 2 3 4 5 | composer config repositories.elpas0-magento2-configuration-arrayserialized git git@github.com:elpas0/magento2-configuration-arrayserialized.git composer require elpas0/magento2-configuration-arrayserialized dev-master php bin/magento setup:upgrade php bin/magento setup:static-content:deploy php bin/magento cache:clean |
Explanation
Register the repository
1 | composer config repositories.elpas0-magento2-configuration-arrayserialized git git@github.com:elpas0/magento2-configuration-arrayserialized.git |
First we add our repository to project composer.json file. Command syntax
1 | composer config repositories.<unique-repo-name> <vcs-type> <vcs-url-https-or-sshl> |
It will add our repository to repositories section of magento json file. Updated section looks like
1 2 3 4 5 6 7 8 9 10 | "repositories": { "0": { "type": "composer", "url": "https://repo.magento.com/" }, "elpas0-magento2-configuration-arrayserialized": { "type": "git", "url": "git@github.com:elpas0/magento2-configuration-arrayserialized.git" } }, |
More information about composer config command can be found here – https://getcomposer.org/doc/03-cli.md#config
Download module files
1 | composer require elpas0/magento2-configuration-arrayserialized dev-master |
It will register module in require section of composer.json and download the files from repository
Module installation
php bin/magento setup:upgrade
– Upgrades the Magento application, DB data, and schema
php bin/magento setup:static-content:deploy
– Deploys static view files
php bin/magento cache:clean
– Cleans cache type(s)
Quick links
Magento 2: How to disable module
Magento 2: How to uninstall module
Magento 2 Command-Line Interface (CLI) Commands List