You can install Magento 2.0 extension (external module) from a Git repository with 4 steps:
Step 1
Register your Git repository for Composer:
composer config repositories.df/blog vcs http://code.dmitry-fedyuk.com/m2/blog.git
If your Git repository is private (as in my case) you can specify auth credetials in composer auth.json
.
For example:
{
"http-basic": {
"code.dmitry-fedyuk.com": {
"username": "<your user name>",
"password": "<your password>"
}
}
}
Step 2
Require your extension through Composer:
composer require df/blog:dev-master
An example of composer.json
for Magento 2.0 extension:
{
"name": "df/blog"
,"description": "Magento 2.0 blog extension"
,"type": "magento2-module"
,"require": {
"php": ">=5.5.0"
,"magento/framework": ">=0.74.0-beta16"
,"magento/magento-composer-installer": "*"
},
"extra": {"map": [["*", "Df/Blog"]]}
}
The type
must be magento2-module
.
Step 3.
Run the Magento upgrade script:
bin/magento setup:upgrade
Note that the module will be added to app/etc/config.php
automatically:
'Df_Blog' => 1
Step 4
Remove the cache.