Coding Standards in Drupal

Coding standards are a set of rules for programmers that lay out best practices, formatting, and various other rules. It tells us how to format what we write, so that everyone is using the same conventions and has the same expectations when they go to look at a new piece of code. This series will:

  • Explain what standards are and why you should use them
  • Show where the official documentation is and how to use it
  • Walk through the most important formatting rules, including for object-oriented code, Twig templating, and many Drupal-specific conventions
  • How to implement Drupal code standards in your tools and projects

This series was originally written by Alanna Burke at Chromatic, and has been generously released under a Creative Commons Attribution-ShareAlike 4.0 International License by them for us to share here, with some modifications and updates. Chromatic is a well-recognized agency in the Drupal space, providing design, development and deployment services to some of the biggest brands in publishing. Chromatic has 10+ years of experience working on large, enterprise Drupal sites. This series is a testament not only to Chromatic's commitment to building Drupal sites the right way, but sharing that information with the open source community.

Chromatic logo