My Coding Standards

Please find below my coding standards that I apply to all my Magento and PHP projects to assure a high level of code quality. These rules will be updated permanently.

You can find my coding standards also on Github.

Backend

Magento

  • Apply Magento coding standards
  • All SQL updates (i.e. also CMS updates) are done via Magento setup scripts
  • Custom settings are configured in separate customer-specific tabs in System -> Configuration, not in Magento default tabs
  • All dependencies are handled via composer
  • Favor observers over rewrites
  • Customer-specific Extensions (in customer namespace, e.g. Vianetz\) are created whenever required
  • Magento Extensions split the system into functional units that have a single responsibility and well-defined dependencies.
  • A Magento Extension should model (part of) a single bounded context of the domain.
  • Modules are natural units for code-ownership as well. Teams can be responsible for one or more modules in the system.
  • Magento Core modifications or modifications to the source code of 3rd-party extensions are strictly prohibited
  • Implement appropriate security measures

Frontend

  • SASS preprocessor is used whenever possible
  • Google Lighthouse Score above 95 in each category is targeted
  • Avoid huge frameworks or libraries
  • Prefer CSS utility classes
  • Websites must be well accessible by screen readers (following rules of W3C)

Häufige Fragen

How can I run the unit tests for your Magento Extension?
See here.