Rate this post

Nice day my friends, today I will show you how to create composer .json file to upload your Magento 2 extension  to Magento Market Place.

Let’s start to create composer.json file to upload your Magento 2 extensions in following steps:

  1. Understanding the composer package structure
  2. Understanding your package
  3.  Fill in your composer.json file by data

As you know Composer is a dependency manager for PHP. Magento 2 uses Composer to package components and product editions.

In the code base, some third-party components that the Magento system uses might not be present . And in the root composer.json file, they are listed as dependencies .Moreover, the Component Manager looks for a composer.json in a component’s root directory might perform actions on the component as well as its dependencies.

Composer Package Structure

You can see in the image bellow to see the structure of composer:

Create composer.json file to upload Magento 2 extension to Marketplace
Create composer.json file to upload Magento 2 extension to Marketplace


And here is the package:

Create composer.json file to upload Magento 2 extension to Marketplace
Create composer.json file to upload Magento 2 extension to Marketplace


Now let’s start to work with composer.json file!


The name of the package. It consists of vendor name and project name, separated by /. Example: magestore/module-bannerslider

-Vendor: magestore

-Project: module-bannerslider


Required for published packages (libraries).


A short description of the package. Usually this is just one line long.


The version of the package.this is not required and should be omitted (see below) in most cases . However, you should have this field to upload the package to the marketplace.

This might follow the format of X.Y.Z or vX.Y.Z with an optional suffix of -dev, -patch (-p), -alpha (-a), -beta (-b) or -RC. By a number, The patch, alpha, beta and RC suffixes might also be followed .


The authors of the package. This is an array of objects.

Each author object can have following properties:

  • name: The author’s name. Usually their real name.
  • email: The author’s email address.
  • homepage: An URL to the author’s website.
  • role: The author’s role in the project (e.g. developer or translator)


The license of the package. This can be either a string or an array of strings.

The recommended notation for the most common licenses is (alphabetical):

  • Apache-2.0
  • BSD-2-Clause
  • BSD-3-Clause
  • BSD-4-Clause
  • GPL-2.0
  • GPL-2.0+
  • GPL-3.0
  • GPL-3.0+
  • LGPL-2.1
  • LGPL-2.1+
  • LGPL-3.0
  • LGPL-3.0+
  • MIT


The type of the package. It defaults to library. In Magento 2 extension, it should be magento2-module


Autoload mapping for a PHP autoloader.

In the Magento 2 extension, you can use psr-4.

After creating the composer.json by this guide, please compress all the file and the folder include the composer.json to the .zip file.

It is the package which you can upload to the Marketplace.

Thank you for reading this post of how to create composer.json file to upload Magento 2 extension to Market place !

How to Catch Magento Rest API Error in Javascript
Why Magento Owners Leave Magento 2.0?

Leave a Reply

Your email address will not be published. Required fields are marked *