If you decided to make an open source module, you should make sure that ever body understand what you did. To make your work less harder, I want to provide a Skeleton Module. Checkout this module, remove the parts you do not need and fill out the gabs you think they are useful.
This module provides a skeleton for a new Magento 2 Module. It comes with examples, best practice advices and useful templates for documentation, specification or testing.
If you think, you have alternative methods or another way of thinking, please feel free to contribute to this skeleton.
This Skeleton tries to cover several aspects:
- Quality of Code
- Legal Advices and Licenses
- Templates for Specification and Documentation
- Basic Setup for Tests
- Tools to get up and running
The README is the first step to a good documentation. This file will be used by Github / Gitlab as a homepage and every developer will know, that there might be some useful information about the code and the structure.
The README File can contain the whole documentation, but if a module is getting bigger and bigger, it might be handy to
use a new directory. We call it doc
. Due to that, we will continue this documentation in the given directory.
Magento 2 uses a custom Mess Detector Ruleset. You will find it under:
/dev/tests/static/testsuite/Magento/Test/Php/_files/phpmd/ruleset.xml
To run the Mess Detector via console, you can run:
# Run in Magento 2 root
php vendor/bin/phpmd app/code/ text dev/tests/static/testsuite/Magento/Test/Php/_files/phpmd/ruleset.xml
or
# Run in Magento 2 root
php bin/magento dev/test/run static
Magento 2 also comes with a custom Code Style Ruleset. You can run the Codesniffer via console with the following commands:
# Run in Magento 2 root
php vendor/bin/phpcs .
Make sure, your composer Packages do not contain any security issues. Validate your composer files by:
- Magento 2 Code demarcation standard
- Magento 2 PHP coding standard
- Magento 2 Code sniffers
- Magento 2 JavaScript coding standard
- Magento 2 jQuery widget coding standard
- Magento 2 DocBlock standard
- Magento 2 JavaScript DocBlock standard
- Magento 2 LESS coding standard
- Magento 2 HTML style guide
The following resource links are a good entry point to document API's in generell.
To make sure, your project is perfectly maintained, I would recommend to use Semantic Versioning and a Changelog in a specific format. You will find more information about these two topics in the following links:
The following tools are personal recommandations and are used to handle common generating and/or documentating tasks.
https://github.com/skywinder/github-changelog-generator