How to install custom extension in Magento2? I have Tier Price extension for last beta version of Magento. It was working well but for testing in stable version, not sure how to install it as there is no app/code folder now in the root of the magento.
5 Answers
You can install Magento 2 extensions with Composer: add an extension's package to the root composer.json
and then do composer update
and bin/magento setup:upgrade
.
-
I do have file structure of the extension CompanyName/ModuleName/{all the folders of the extension like Block,Controller,etc,Helper,Model,view} Do I need to make entry in composer.json file something? If so can you please tell me in detail? Commented Nov 20, 2015 at 12:07
-
Loading composer repositories with package information Authentication required (repo.magento.com): Username: What is the username and pwd to update composer now? Commented Nov 20, 2015 at 12:20
-
1Should use your credentials from magentocommerce.com Commented Nov 20, 2015 at 13:09
-
Thanks :) Can you also answer for the question i asked? What do i need to do to install the custom extension? I tried to make an entry in composor.json and run the composor update command, but getting this Loading composer repositories with package information Updating dependencies (including require-dev) Your requirements could not be resolved to an installable set of packages. Problem 1 - The requested package magecomp/tierprice could not be found in any version, there may be a typo in the package name. Commented Nov 20, 2015 at 13:22
Once the magento extension gets downloaded in below format
< namespace_modulename-version.zip>
then follow these installation steps-
Unzip the Downloaded folder
Check for the unzipped folder whether it contains app folder or module name
a)for app folder, overwrite the unzipped folder parallel to the app
b) if you are getting the folder with the module name, create a new folder under the app code directory and rename it with the module's namespace then paste the folder under the module namespace folder created initially.
Navigate to the Magento root directory path where the module is to be installed, via terminal (cmd) and run the following commands sequentially:
a) php bin\magento setup:upgrade
b) php bin\magento setup:static-content:deploy
c) clear the Magento cache from the Magento admin panel
It is simple to install a custom module:
Via Composer:
composer require mageplaza/magento-2-blog-extension
php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy
app/code
is missing because all Magento modules are put to vendor directory for 3rd-party developers convenience, so they do not have to mix their own code with the core. Now it is easy to develop custom modules without committing the whole Magento core to your git repository (unlike in Magento 1). This can be done as follows:
- Download this Magento 2 project https://github.com/magento/magento2-community-edition (if you do it via
git clone
make sure to executerm -rf .git
just after that) - Run
composer update
in the Magento root - Initialize new git repository in the root of Magento
- Almost all core files/directories are already added to the root
.gitignore
, but it is better to add the following 2 as well/update
and/phpserver
(just add these 2 lines to .gitignore) - Add all untracked files to git and commit them (should be only 3 files, all other are already added to
.gitignore
in the root of Magento.) - Start development of your modules as usual (put them under
app/code/YourCompanyName/YourModuleName
), now you will have only your custom code in your git repository
-
I am trying to use this module github.com/cadencelabs/urldedup, which does not have composer file. Basically all of my modules are under vendor as you mentioned. I followed their instruction and added the file under app/code/ and ran the upgrade & compile command and flush cache. But the module is not showing up. Do you know how this can be solved?– KorbinCommented Sep 6, 2018 at 9:25
-
@k185 use this in your command prompt to install this module mkdir -p app/code/Cadence/UrlDedup && git clone github.com/cadencelabs/urldedup app/code/Cadence/UrlDedup and then php bin/magento setup:upgrade Commented Sep 6, 2018 at 9:36
-
I did follow their instruction, but for some reasons it is not working, After running the command and then upgrade, di:compile and flush:cache, the module is not showing with bin/magento module:status. It is not also showing in admin ->store->configuration->Advanced->Advanced– KorbinCommented Sep 6, 2018 at 9:42
Connect your FTP and paste your Magento 2 extenstion inside directory:
app/code/
Connect the ssh and run the below commonds in root directory:
rm -rf var/*
rm -rf pub/static/*
php bin/magento setup:upgrade //(only for new extension)
php bin/magento setup:static-content:deploy
chmod -R 777 var pub/static