---
title: Magento 2- Create modules with composer
description: Composer is an application level package-manager for PHP and Magento 2. It provides a standard format to manage dependencies of Magento 2 application and required libraries.
---

[![e-Zest logo\_An accion lab company\_Colour](https://blog.e-zest.com/hubfs/images/Logos%20with%20Tagline/Corporate/SVG/e-Zest%20logo_An%20accion%20lab%20company_Colour.svg "e-Zest logo_An accion lab company_Colour")](https://www.e-zest.com/)

- [WORK](https://www.e-zest.com/our-work)
- [SERVICES](https://www.e-zest.com/our-services) 
    - [Product Engineering](https://www.e-zest.com/digital-product-engineering-services)
    - [Enterprise Data Services](https://www.e-zest.com/enterprise-data-services)
    - [Digital Commerce](https://www.e-zest.com/digital-commerce-services)
    - [Digital Operations](https://www.e-zest.com/digital-operations)
    - [Digital Consulting](https://www.e-zest.com/digital-transformation-consulting-services)
    - [Digital Experience Design](https://www.e-zest.com/digital-experience-design)
- [INSIGHTS](https://blog.e-zest.com/)
- [CAREERS](https://www.e-zest.com/careers)
- [ENTERPRISE DATA SERVICES](https://www.e-zest.com/enterprise-data-services)
- [GENERATIVE AI](https://www.e-zest.com/generative-ai)
- [Healthcare](https://healthcare.e-zest.com)
- [Contact Us](https://www.e-zest.com/contact-us)

- ![Elevating Product Engineering with AI and ML](https://blog.e-zest.com/hubfs/Elevating%20Product%20Engineering%20with%20AI%20and%20ML.jpg)

  [BLOGS](https://blog.e-zest.com)
  
  #### Elevating Product Engineering with AI and ML

  As technology evolves and customer choices broaden, there is an increasing ...

  [Read more](https://blog.e-zest.com/elevating-product-engineering-with-ai-and-ml)
- ![e-Zest – An Accion Labs Company gets Recognition as a Contender in the ISG Provider Lens™ Study on Digital Engineering Services 2024](https://blog.e-zest.com/hubfs/e-Zest%20%E2%80%93%20An%20Accion%20Labs%20Company%20-%20Gets%20Recognition%20as%20a%20Contender%20in%20the%20ISG%20Provider%20LensTM%20Study%20on%20Digital%20Engineering%20Services%202024.jpg)

  [NEWS](https://blog.e-zest.com/news)
  
  #### e-Zest – An Accion Labs Company gets Recognition as a Contender in the ISG Provider Lens™ Study on Digital Engineering Services 2024

  We are delighted to announce that e-Zest – An Accion Labs Company has been ...

  [Read more](https://blog.e-zest.com/news/e-zest-an-accion-labs-company-gets-recognition-as-a-contender-in-the-isg-provider-lens-study-on-digital-engineering-services-2024)
- ![e-Zest Solutions supports Digital Pune Mission](https://blog.e-zest.com/hubfs/blog-files/Digital%20Literacy%20Bus%20e-Zest.png)

  [CSR](https://blog.e-zest.com/csr)
  
  #### e-Zest Solutions supports Digital Pune Mission

  **Pune, India:** e-Zest Solutions, a leading digital technology innovation ...

  [Read more](https://blog.e-zest.com/csr/e-zest-solutions-supports-digital-pune-mission)

- [Work](https://www.e-zest.com/our-work)
- [Services](https://www.e-zest.com/our-services)
- [Insights](https://blog.e-zest.com)
- [Careers](https://www.e-zest.com/careers)
- [Enterprise Data](https://www.e-zest.com/enterprise-data-services)
- [Generative AI](https://www.e-zest.com/generative-ai)
- [Innovations](https://www.e-zest.com/innovations)
- [Healthcare](https://healthcare.e-zest.com)
- [About](https://www.e-zest.com/about-us)
- [Contact](https://www.e-zest.com/contact-us)

- [Blog](https://blog.e-zest.com/)
- [News](https://blog.e-zest.com/news)
- [CSR](https://blog.e-zest.com/csr)

- [![Linkedin Icon](https://blog.e-zest.com/hubfs/icons/linkedin_icon_white.svg)](https://www.linkedin.com/company/e-zest-solutions/)
- [![Twitter Icon](https://blog.e-zest.com/hubfs/twitter-logo-silhouette%20(5).svg)](https://twitter.com/ezest)
- [![Facebook Icon](https://blog.e-zest.com/hubfs/facebook-app-logo%20(4).svg)](https://www.facebook.com/61259256638)
- [![Instagram Icon](https://blog.e-zest.com/hubfs/instagram-logo%20(4).svg)](https://www.instagram.com/ezestsolutions/)
- [![Youtube Icon](https://blog.e-zest.com/hubfs/icons/youtube_icon_white.svg)](https://www.youtube.com/user/ezestcorporate)

[![Go to top icon](https://blog.e-zest.com/hubfs/AA%20Assets/top%20button.svg)](https://blog.e-zest.com/magento-2-create-modules-with-composer#top)

Hit enter to search or ESC to close

Insights

e-Zest members share technology ideas to foster digital transformation.

- [Blog](https://blog.e-zest.com)
- [Whitepaper](https://blog.e-zest.com/whitepaper)
- [Playbook](https://blog.e-zest.com/playbook)
- [News](https://blog.e-zest.com/news)
- [Innovation](https://blog.e-zest.com/innovation)
- [Media Kit](https://www.e-zest.com/media-kit)

# Magento 2- Create modules with composer

[Yash Kothari](https://blog.e-zest.com/author/yash-kothari)  Sep 17, 2018

[Magento 2.0](https://blog.e-zest.com/topic/magento-2-0) [For Developers](https://blog.e-zest.com/topic/for-developers) [Composer](https://blog.e-zest.com/topic/composer)

- <https://www.linkedin.com/shareArticle?mini=true&url=https://blog.e-zest.com/magento-2-create-modules-with-composer&title=&summary=&source=>
- <https://twitter.com/intent/tweet?source=https://blog.e-zest.com/magento-2-create-modules-with-composer&text=Magento%202-%20Create%20modules%20with%20composer>
- <https://www.facebook.com/sharer/sharer.php?u=https://blog.e-zest.com/magento-2-create-modules-with-composer>
- <https://www.instagram.com/ezestsolutions/?u=https://blog.e-zest.com/magento-2-create-modules-with-composer>

**What is Composer? Why it is required?**

Composer is an application level package-manager for PHP and Magento 2. It provides a standard format to manage dependencies of Magento 2 application and required libraries.  
Composer allows developers to install PHP applications that are available on “Packagist”. It also provides autoload capabilities for libraries.

For magento2 composer can update, uninstall, enable, or disable an extension if installed using Composer (including from Packagist, Magento Marketplace, or another source) and it has a composer.json file. The Component Manager can still disable or enable an extension not installed using Composer (e.g. custom code) if it has a composer.json file. (For more details, refer: [https://devdocs.magento.com/guides/v2.0/extension-dev-guide/build/composer-integration.html)](https://devdocs.magento.com/guides/v2.0/extension-dev-guide/build/composer-integration.html\))

**How to use composer in Magento 2?**

To create a module that supports composer based installation the only required step is to create a composer.json file for it.

**Step 1: Create composer.json file for any module**

Create new composer.json file in location app/code/\<vendor-name\>/\<module-name\>/composer.json

Required information for this file:

**name**- It should be component name, format is \<vendor-name\>/\<component-name\>.  
All letters must be in lowercase. You can use dashes in the \<component-name\> to separate words.

**type-** For a new module, this value must be set to magento2-module.

Other possible types are *project, metapackage, magento2-library, magento2-theme, and magento2-language*.

**autoload-** Specify necessary information to be loaded, such as registration.php.

Sample composer.json

![magento-1-1](https://blog.e-zest.com/hs-fs/hubfs/magento-1-1.png?width=600&name=magento-1-1.png)![magento-2-1](https://blog.e-zest.com/hs-fs/hubfs/magento-2-1.png?width=600&name=magento-2-1.png)  
**Step 2: Create and Validate the package**

Create a package of your module by performing a zip operation on the directory with your extension.  
A sample command can be as:

zip -r ezest-digital-commerce\_customer-loyalty-1.1.1.zip package-path/ -x 'package-path/.git/\*'

(Use alphanumeric characters for the package filename with dashes to separate words. Do not use whitespaces.)

Magento can retrieve your extension package from any valid GitHub URL.

Third party repositories are also supported. For that add the following to your composer.json file:

![magento-3-1](https://blog.e-zest.com/hs-fs/hubfs/magento-3-1.png?width=600&name=magento-3-1.png)  
Use [validation tool](https://github.com/magento/marketplace-tools) to verify your package.

Your package is ready to publish and destitute.

Stay tuned for my next blog in which we will learn how to install any module using Composer in Magento 2.

- <https://twitter.com/intent/tweet?source=https://blog.e-zest.com/magento-2-create-modules-with-composer&text=Magento%202-%20Create%20modules%20with%20composer>
- <https://www.facebook.com/sharer/sharer.php?u=https://blog.e-zest.com/magento-2-create-modules-with-composer>
- <https://www.linkedin.com/shareArticle?mini=true&url=https://blog.e-zest.com/magento-2-create-modules-with-composer&title=&summary=&source=>

### Similar Blog

[![How to setup Docker Container for Magento 2](https://blog.e-zest.com/hubfs/How%20to%20setup%20Docker%20Container%20for%20Magento%202.jpg) How to setup Docker Container for Magento 2 Docker is an application that allows us to manage multiple applications in the simplest way in the docker container. Docker ... By Rajesh Rathod Oct 15, 2021](https://blog.e-zest.com/how-to-setup-docker-container-for-magento2)

[![Magento 2: Module Code Generation with Pestle](https://blog.e-zest.com/hubfs/blog-files/Magento%202%20%20Module%20code%20generation%20with%20Pestle.png) Magento 2: Module Code Generation with Pestle **What is Pestle?**The Pestle is a new PHP (5.6+) framework for creating and organizing PHP programs into Python like libraries of ... By Makarand Uparwat Nov 20, 2018](https://blog.e-zest.com/magento-2-module-code-generation-with-pestle)

[Custom Sessions in Magento 2 Sessions play an important role in enhancing the user experience and they also help gather vital stats about the user visits. In ... By Pooja Pardeshi Nov 15, 2018](https://blog.e-zest.com/custom-sessions-in-magento-2)

[![Magento 2 - How to display CMS block in Checkout Sidebar](https://blog.e-zest.com/hubfs/how-to-display-cms-block-in-checkout-sidebar.png) Magento 2 - How to display CMS block in Checkout Sidebar Using CMS blocks, site administrator can easily manipulate content of the vendor. CMS blocks can be used to display promotional ... By Sejal Shah Nov 01, 2018](https://blog.e-zest.com/magento-2-how-to-display-cms-block-in-checkout-sidebar)

[![Code validations using static-review library in Magento](https://blog.e-zest.com/hubfs/code-validations-using-static-review-library-in-magento.png) Code validations using static-review library in Magento **Introduction:**Magento2 comes up with some advance tools and plugins, which are really useful for developers to track some common ... By Shubh Sharma Oct 19, 2018](https://blog.e-zest.com/code-validations-using-static-review-library-in-magento)

## Helping Organizations Thrive in the Digital Age

[Contact Us](https://www.e-zest.com/contact-us)

- [About](https://www.e-zest.com/about-us)
- [Services](https://www.e-zest.com/our-services)
- [Work](https://www.e-zest.com/our-work)
- [Insights](https://blog.e-zest.com/)
- [Healthcare](https://healthcare.e-zest.com/)
- [Accion Labs](https://www.accionlabs.com/)

- <https://www.linkedin.com/company/e-zest-solutions/>
- <https://twitter.com/ezest>
- <https://www.facebook.com/eZest/>
- <https://www.instagram.com/ezestsolutions/>
- <https://www.youtube.com/user/ezestcorporate>

- Dallas
- Detroit
- Hannover
- Vienna
- London
- Pune

 © 2025 e-Zest Solutions

- [Privacy Policy](https://www.e-zest.com/privacypolicy)
- [Cookie Policy](https://www.e-zest.com/cookie-policy)

 Contact us

 Contact us

e-Zest is a leading digital innovation partner for enterprises and technology companies that utilizes emerging technologies for creating engaging customers experiences. Being a customer-focused and technology-driven company, it always helps clients in crafting holistic business value for their software development efforts. It offers software development and consulting services for cloud computing, enterprise mobility, big data and analytics, user experience and digital commerce.