I'm have my own magento 2 module. It's allready uploaded on Gitlab. What i must do to install this module using composer require?


To be able to install the module using composer, Your module should be available at packagist.org, You can link your git repository there. So, you need to Register, and Submit your package there first.

| improve this answer | |
  • Thanks for information. :) – Raj Oct 5 '19 at 11:30

You're on the right track with your test module, you just need to move the repository block from your package's composer.json to the main composer file in your Magento installation.

First, fix your module composer file by removing the repository block.


    "name": "illia/module-test",
    "description": "13132",
    "license": "proprietary",
    "authors": [
            "name": "Mage2Gen",
            "email": "info@mage2gen.com"
    "minimum-stability": "dev",
    "require": {},
    "autoload": {
        "psr-4": {
            "Illia\\Test\\": ""
        "files": [

Commit those changes, then add a reference to your repository in


"repositories": [
        "type": "composer",
        "url": "https://repo.magento.com/"
        "type": "git",
        "url": "https://github.com/arefyevi/test.git"

Finally, require your package and install

composer require illia/module-test @dev

This process is the same regardless if you're using Gitlab or Github, you'll just need to update the repository url to point to the correct package.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.