Which steps need to follow For Standard Extension Development for Magento 2

by mageefy on Feb 13, 2023 Celebrities 436 Views

For a Magento 2 extension, you should be following the Magento EQP (Extension Quality Program) code standards. Magento provides a tool to validate the PSR-2 code standards and most of Magento's added standards on top of that. Magento has provided the package validation tool, Which detects any kind of packaging errors to reduce the module rejections from the Marketplace.

Steps which need to follow For Standard Extension Development for Magento 2 :

  • 1) must have composer.json in root folder of extension(Eg. app/code/Vendor/Module/composer.json)
  • 2) must have registration.php in root folder of extension (Eg. app/code/Vendor/Module/registration.php)
  • 3) Do not use $_REQUEST, $_POST directly
  • 4) Never end class file with ending php tag ?>
  • 5) Remove unnecessory code and comments
  • 6) Use spaces for indentation
  • 7) check with phpcs coding standard and remove all errors, Refer Coding standard tab
  • 8) Must pass severity=10 while chicking coding standard with MEQP2, Refer coding standard
  • 9) do compilation and resolve all errors
  • 10) validate_m2_package_v2

Follow the below steps to validate your package with "validate_m2_package.php" :

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.

for example:
php validate_m2_package.php -d modulename.zip

https://www.mageefy.com/blog/post/steps-need-follow-standard-extension-development-magento-2

Article source: https://article-realm.com/article/Arts-Entertainment/Celebrities/37103-Which-steps-need-to-follow-For-Standard-Extension-Development-for-Magento-2.html

Comments

No comments have been left here yet. Be the first who will do it.
Safety

captchaPlease input letters you see on the image.
Click on image to redraw.

Reviews

Guest

Overall Rating:

Most Viewed Articles

Statistics

Members
Members: 17265
Publishing
Articles: 79,973
Categories: 202
Online
Active Users: 1177
Members: 3
Guests: 1174
Bots: 8335
Visits last 24h (live): 5962
Visits last 24h (bots): 96718

Latest Comments

This blog really convinced me to do it! Thanks, very good post  Jpbosku    
This blog really convinced me to do it! Thanks, very good post  Jpbosku    
Thanks for sharing these informations. I really like your blog post very much. You have really shared a informative and interesting blog post .    pakde4d    
I love the way you write and share your niche! Very interesting and different!    pakde4d    
Good to become visiting your weblog again, it has been months for me. Nicely this article that i've been waited for so long. I will need this post to total my assignment in the college, and it has...
This is a great inspiring article.I am pretty much pleased with your good work.You put really very helpful information.. pakde4d  
I would like to thank you for the efforts you have made in writing this article. I am hoping the same best work from you in the future as well. In fact your creative writing abilities has inspired...
Truly, this article is really one of the very best in the history of articles. I am a antique ’Article’ collector and I sometimes read some new articles if I find them interesting. And I found...
Since moving through different routines in Canada, I've realised how important it is to have hobbies that don't require complicated planning. Sometimes I go cycling or meet friends, while...
Planning a date night in Saskatchewan is super easy when you have awesome local entertainment options nearby. My partner and I enjoyed a wonderful dinner and spent a few hours at  casino gold...

Translate To: