How to Create Extension Package in Magento 2?

Let's say you have developped a module under app/code/Vendor/Module, here is the procedure you have to follow:

Create a composer file

Go to app/code/Vendor/Module and create the following composer.json file:

{
  "name": "vendor/module",
  "description": "Description of your Magento 2 module",
  "type": "magento2-module",
  "version": "0.1.0",
  "license": [
    "OSL-3.0",
    "AFL-3.0"
  ],
  "require": {
    "php": "~5.5.0|~5.6.0|~7.0.0",
    "magento/framework": "~100.0.4"
  },
  "authors": [
    {
      "name": "Firstname Lastname",
      "email": "[email protected]",
      "homepage": "https://www.store.com/",
      "role": "Developer"
    }
  ],
  "autoload": {
    "files": [ "registration.php" ],
    "psr-4": {
      "Vendor\\Module\\": ""
    }
  }
}

Zip the package

Using command line do the following:

cd /path/to/app/code/Vendor/Module
zip -r vendor_module-0.1.0.zip ./*

N.B.: this example is assuming that your module version (declared under app/code/Vendor/Module/etc/module.xml is 0.1.0, please change the version in both the composer.json and in the command that zips the package to match your version.


To create extension package and how to publish it, check following source :

  1. http://devdocs.magento.com/guides/v2.0/extension-dev-guide/package/package_module.html
  2. http://docs.magento.com/marketplace/user_guide/getting-started.html

Hope it helps