Merchants with Magento as their eCommerce platform use extensions to make their online stores to do even more. Extensions play a crucial role and it is important to ensure their quality.
This article explains how to validate your Magento 2 composer package before submitting to the Marketplace. A report from Magento says, approximately 20 extensions are rejected every week due to improper packaging and bad coding standards.
Some time back, Alan kent, Magento’s Chief Architect provided the marketplace upload validation tool which detects packaging errors to reduce the module rejections. And yes it really helps a lot in validating the extension before submission.
Follow the below steps to validate your package
- Clone the repository https://github.com/magento/marketplace-tools or Download the file validate_m2_package.php
- Now place your module zipped file in the same folder where you placed the previous file.
Note: To zip your package, navigate to root path of your module i.e /app/code/Vendor Name/Module Name/ and then zip your package. Make sure composer.json remains in the root path of your zipped package.
- Now execute the following command
$ <path_to_php> validate_m2_package.php -d vendor-modulename.zip
where <path_to_php> is the path to php compiler and vendor-modulename.zip should be name of your module zipped file.
-d – Provides debugs messages. Optional.
No success message will be printed if the package passes the validation. The validation tool will display errors & warnings if it finds any. Warnings can be ignored. But errors should be fixed and validated again to proceed further.
Soon we will be writing another blog to configure and use Magento Extension Quality Program (EQP) tool. The tool ensures the code quality and helps in passing the Level 1 review. Keep watching this space.
For further insights on delivering quality extensions, you can go through the Imagine 2017 – Technical Deep Dive session, on How to Pass the Magento Marketplace Extension Quality Program by Jason Cochran, presented by Head of Marketplace Engineering, Magento Commerce.