Skip to main content
2 of 3
added 7 characters in body
Silvan
  • 1.4k
  • 6
  • 33
  • 55

This is the way to go:

"autoload": {
    "files": [ "registration.php" ],
    "psr-4": {
      "Amit\\SamplePage\\": ""
    }
  }

The map function in Composer:

   "extra": {
        "map": [
            [
                "*",
                "Amit/SamplePage"
            ]
        ]
    }

forces te extension to be installed in app/code. This was used in older beta's of Magento 2. Although this will work, it's not the way Magento loads extensions anymore. If you do not use the map function the extension will be installed in the vendor folder, as it should be.

Registration.php defines the type: theme or extension and registers your theme/extension in Magento 2.

The composer.json file is added so the extension can be loaded via composer. It also handles the autoloading for your extension.

Silvan
  • 1.4k
  • 6
  • 33
  • 55