Modules are the ones that interact with various parts of the application to provide new features or satisfy a business requirement. A module may contain user interface for interacting with the user and displaying information to users. A theme in Magento instance provides customized look and feel for the frontend and can also be for the admin. Blank Theme and Luma theme are the two base themes that comes with Magento by default and developers can use these theme as base to develop new themes. Language Packages provides options for internationalization and localization. You can have your storefront displayed in multiple languages based on the user's choice.
Today in this post we will look into the basic elements needed for a Magento 2 module and also the steps on how to validate your Magento 2 module using Magento's free validation tool:
1. composer.json - used to specify the component dependencies
2. registration.php - used to register your component
3. Based on the component that you are planning to develop, you would use one of the following:
a. module.xml for developing a Module
b. theme.xml for Theme Development
c. language.xml for Language Packages.
4. Once you are done with the module development, then things would be to package it. You will have to do it in ZIP format.
5. After you are done with packing your component, you can use Magento's validation tool to check your component for suitability.
Steps to validate you Magento 2 package:
1. Download the validate_m2_package.php file provided by Magento from the following GitHub location:
2. Upload this file to the docroot of your Magento Installation via FTP/SSH.
3. Package names should of the following format:
4. Upload your package file to the docroot of your Magento installation via FTP/SSH.
5. Login to your server via SSH and navigate to the docroot of your Magento installation using cd command and execute the following command where -d represents debug:
<path_to_php > validate_m2_package.php -d vendor-name_package-name-1.0.0.zip
If the validation passes successfully, then no message would be displayed. If there are any errors in the module package, then the same would be displayed in the console as out coming result.