This guide is for developers that are building a new component from scratch for custom extension of Magento functionality.
Magento is made up of the following types of components:
* Modules (extend Magento capabilities) * Themes (change the look and feel of your storefront and Admin) * Language packages (localize the storefront and Admin) * Libraries (common code)
A Magento module is a discrete chunk of code that accomplishes a particular business function or handles a Magento feature. A module
is typically a collection
.xml files, and the bulk of your work in modules will be in these files. Modules interact with each other. A module also contains any user interface required for a user’s interaction with the module, and any application interfaces that another module or code chunk might call, if you decide to expose any application interface to other Magento modules.
Themes can be applied to the module to change its appearance. So when you are building a module, you might also touch themes and language packages.
A package is a component that is wrapped up in a distributable form. Usually you will use Composer to do this.
An extension is a component that are packaged for sale on Magento Marketplace.
Magento Marketplace is one way to distribute your components. This guide provide information about how to distribute your components using other means as well (such as a separate source control repository).
You must follow a PSR compliant structure when building a module.
Magento module example
Modules are declared in the
module.xml file. Here is a minimal example:
<?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> <module name="Magento_SampleMinimal" setup_version="2.0.0"> </module> </config>
Get your feet wet quickly and build a simple Magento module.
Or jump right in and use a worksheet that steps you through a complete best practice method to build, test, and package a Magento module.